Bump version. Rebuild artifacts.
This commit is contained in:
parent
3d57be4858
commit
ed206d68d8
|
@ -4576,6 +4576,46 @@ define('src/fs',['require','nodash','encoding','src/path','src/path','src/path',
|
|||
}
|
||||
}
|
||||
|
||||
function replace_data(context, ofd, buffer, offset, length, callback) {
|
||||
var fileNode;
|
||||
|
||||
function return_nbytes(error) {
|
||||
if(error) {
|
||||
callback(error);
|
||||
} else {
|
||||
callback(null, length);
|
||||
}
|
||||
}
|
||||
|
||||
function update_file_node(error) {
|
||||
if(error) {
|
||||
callback(error);
|
||||
} else {
|
||||
context.put(fileNode.id, fileNode, return_nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
function write_file_data(error, result) {
|
||||
if(error) {
|
||||
callback(error);
|
||||
} else {
|
||||
fileNode = result;
|
||||
var newData = new Uint8Array(length);
|
||||
var bufferWindow = buffer.subarray(offset, offset + length);
|
||||
newData.set(bufferWindow);
|
||||
ofd.position = length;
|
||||
|
||||
fileNode.size = length;
|
||||
fileNode.mtime = Date.now();
|
||||
fileNode.version += 1;
|
||||
|
||||
context.put(fileNode.data, newData, update_file_node);
|
||||
}
|
||||
}
|
||||
|
||||
context.get(ofd.id, write_file_data);
|
||||
}
|
||||
|
||||
function write_data(context, ofd, buffer, offset, length, position, callback) {
|
||||
var fileNode;
|
||||
var fileData;
|
||||
|
@ -4607,7 +4647,8 @@ define('src/fs',['require','nodash','encoding','src/path','src/path','src/path',
|
|||
if(fileData) {
|
||||
newData.set(fileData);
|
||||
}
|
||||
newData.set(buffer, _position);
|
||||
var bufferWindow = buffer.subarray(offset, offset + length);
|
||||
newData.set(bufferWindow, _position);
|
||||
if(undefined === position) {
|
||||
ofd.position += length;
|
||||
}
|
||||
|
@ -5696,7 +5737,7 @@ define('src/fs',['require','nodash','encoding','src/path','src/path','src/path',
|
|||
var ofd = new OpenFileDescription(fileNode.id, flags, 0);
|
||||
var fd = fs.allocDescriptor(ofd);
|
||||
|
||||
write_data(context, ofd, data, 0, data.length, 0, function(err2, nbytes) {
|
||||
replace_data(context, ofd, data, 0, data.length, function(err2, nbytes) {
|
||||
if(err2) {
|
||||
return callback(err2);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
|||
"name": "filer",
|
||||
"description": "Node-like file system for browsers",
|
||||
"keywords": ["fs", "node", "file", "system", "browser", "indexeddb", "idb", "websql"],
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"author": "Alan K <ack@modeswitch.org> (http://blog.modeswitch.org)",
|
||||
"homepage": "http://js-platform.github.io/filer",
|
||||
"bugs": "https://github.com/js-platform/filer/issues",
|
||||
|
|
Loading…
Reference in New Issue