Comparing version 0.9.0 to 0.9.1
@@ -32,3 +32,4 @@ var events = require('events'), | ||
q.acquire(function (unlock) { // because of this, callers can start before 'ready' | ||
volume.readSectors(0, new Buffer(volume.sectorSize), function (e,d) { | ||
var d = new Buffer(volume.sectorSize); | ||
volume.readSectors(0, d, function (e) { | ||
if (e) fs.emit('error', e); | ||
@@ -35,0 +36,0 @@ else { |
{ | ||
"name": "fatfs", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "fs implementation on top of raw FAT16/FAT32 block source", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,3 +33,3 @@ // can be called from CLI with image type, absolute path to an image, or, required as a module | ||
waitTime || (waitTime = 1e3); | ||
waitTime || (waitTime = 0.5e3); | ||
@@ -237,3 +237,3 @@ [ | ||
ct = Date.now(); | ||
assert(tf - 2*waitTime < ct && ct < tf + 2*waitTime, "Modify time is within ± two `waitTime`s of now."); | ||
assert(tf-2e3 < ct && ct < tf+2e3+waitTime, "Modify time is within ± a few seconds of now."); | ||
@@ -240,0 +240,0 @@ // NOTE: due to serialization, this can check results of the `fs.chmod` below, too! |
16
vol.js
@@ -46,10 +46,10 @@ var S = require("./structs.js"), | ||
vol._readSector = function (secNum, n, cb) { | ||
if (typeof n === 'function') { | ||
cb = n; | ||
n = 1; | ||
vol._readSector = function (secNum, dest, cb) { | ||
if (typeof dest === 'function') { | ||
cb = dest; | ||
dest = new Buffer(vol._sectorSize); | ||
} | ||
//console.log("_readSector", secNum, n); | ||
//console.log("_readSector", secNum, n, Error().stack); | ||
if (secNum < volume.numSectors) volume.readSectors(secNum, new Buffer(vol._sectorSize), cb); | ||
//console.log("_readSector", secNum, dest.length); | ||
//console.log("_readSector", secNum, dest.length, Error().stack); | ||
if (secNum < volume.numSectors) volume.readSectors(secNum, dest, function (e) { cb(e, dest); }); | ||
else throw Error("Invalid sector number!"); | ||
@@ -63,3 +63,3 @@ }; | ||
// NOTE: these are internal assertions, public API will get proper `S.err`s | ||
if (data.length !== volume.sectorSize) throw Error("Buffer does not match sector size"); | ||
if (data.length % volume.sectorSize) throw Error("Buffer length not a multiple of sector size"); | ||
else if (opts.ro) throw Error("Read-only filesystem"); | ||
@@ -66,0 +66,0 @@ else if (secNum < volume.numSectors) volume.writeSectors(secNum, data, cb); |
91246
1820