1 local io_open
= io
.open
;
2 local dm
= require
"core.storagemanager".olddm
;
4 -- Append a blob of data to a file
5 function dm
.append_raw(username
, host
, datastore
, ext
, data
)
6 if type(data
) ~= "string" then return; end
7 local filename
= dm
.getpath(username
, host
, datastore
, ext
, true);
10 local f
, msg
= io_open(filename
, "r+");
12 -- File did probably not exist, let's create it
13 f
, msg
= io_open(filename
, "w");
15 return nil, msg
, "open";
19 local pos
= f
:seek("end");
21 ok
, msg
= f
:write(data
);
24 return ok
, msg
, "write";