Comparing version 1.1.0 to 1.2.0
@@ -186,3 +186,3 @@ var util = require('util') | ||
for (var i = 0; i < entries.length; i++) { | ||
fullPathList.push(entries[i].fullPath) | ||
fullPathList.push(entries[i].name) | ||
} | ||
@@ -469,5 +469,6 @@ callback(null, fullPathList) | ||
fd.onerror = callback | ||
var bufblob = new Blob([buffer.slice(offset, length)], {type: 'application/octet-binary'}) // eslint-disable-line | ||
var tmpbuf = buffer.slice(offset, length) | ||
var bufblob = new Blob([tmpbuf], {type: 'application/octet-binary'}) // eslint-disable-line | ||
fd.write(bufblob) | ||
callback() | ||
window.setTimeout(callback, 0, null, tmpbuf.length) | ||
} | ||
@@ -491,9 +492,30 @@ | ||
var blob = new Blob([buffer], {type: 'text/plain'}) // eslint-disable-line | ||
if (position !== null) { | ||
fd.seek(position) | ||
var buf = new Buffer(buffer) | ||
if (fd.readyState > 0) { | ||
if (position !== null) { | ||
window.setTimeout(delayedPositionWrite, 0, position, blob, callback, buf.length, fd) | ||
} else { | ||
window.setTimeout(delayedWrite, 0, blob, callback, buf.length, fd) | ||
} | ||
} else { | ||
if (position !== null) { | ||
fd.seek(position) | ||
} | ||
fd.write(blob) | ||
window.setTimeout(callback, 0, null, buf.length) | ||
} | ||
} | ||
function delayedPositionWrite (position, blob, cb, length, fd) { | ||
fd.seek(position) | ||
fd.write(blob) | ||
callback() | ||
cb(null, length) | ||
} | ||
function delayedWrite (blob, cb, length, fd) { | ||
fd.write(blob) | ||
cb(null, length) | ||
} | ||
exports.unlink = function (fd, callback) { | ||
@@ -614,3 +636,6 @@ var path = resolve(fd) | ||
exports.close = function (fd, callback) { | ||
fd.onwriteend = makeCallback(callback) | ||
fd.onwriteend = function (info) { | ||
var cb = makeCallback(callback) | ||
cb(null, info) | ||
} | ||
} | ||
@@ -617,0 +642,0 @@ |
{ | ||
"name": "chrome-fs", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Use the Node `fs` API in Chrome Apps", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -18,3 +18,4 @@ # chrome-fs | ||
- [x] rs.rename(oldPath, newPath, callback) | ||
#### fs | ||
- [x] fs.rename(oldPath, newPath, callback) | ||
- [x] fs.ftruncate(fd, len, callback) | ||
@@ -54,18 +55,23 @@ - [x] fs.truncate(path, len, callback) | ||
- [ ] fs.access(path[, mode], callback) | ||
Class: - [ ] fs.Stats | ||
Stat Time Values | ||
- [ ] fs.createReadStream(path[, options]) | ||
- Class: | ||
#### Class: - fs.Stats | ||
- [ ] fs.Stats | ||
- [ ] Stat Time Values | ||
#### Class: - fs.ReadStream | ||
- [ ] fs.ReadStream | ||
- Event: 'open' | ||
- [ ] Event: 'open' | ||
- [ ] fs.createWriteStream(path[, options]) | ||
Class: | ||
#### Class: - fs.WriteStream | ||
- [ ] fs.WriteStream | ||
- Event: 'open' | ||
- file.bytesWritten | ||
Class: | ||
- [ ] Event: 'open' | ||
- [ ] file.bytesWritten | ||
#### Class: - fs.FSWatcher | ||
- [ ] fs.FSWatcher | ||
- watcher.close() | ||
- Event: 'change' | ||
- Event: 'error' | ||
- [ ] watcher.close() | ||
- [ ] Event: 'change' | ||
- [ ] Event: 'error' | ||
@@ -72,0 +78,0 @@ ## Test |
@@ -5,3 +5,7 @@ var test_fs_stat = require('../simple/test-fs-stat') // eslint-disable-line | ||
var test_fs_append_file = require('../simple/test-fs-append-file') // eslint-disable-line | ||
var test_fs_mkdir = require('../simple/test-fs-mkdir') // eslint-disable-line | ||
var test_readdir = require('../simple/test-fs-readdir') // eslint-disable-line | ||
var test_fs_write = require('../simple/test-fs-write') // eslint-disable-line | ||
// var test_fs_empty_readStream = require('../simple/test-fs-empty-readStream') // eslint-disable-line | ||
// var read_stream_fd_test = require('../simple/test-fs-read-stream-fd') // eslint-disable-line |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
266056
23
7494
118