Comparing version 4.9.1 to 5.0.0-next.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -53,2 +53,1 @@ "use strict"; | ||
}; | ||
//# sourceMappingURL=constants.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=AMODE.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=FLAG.js.map |
@@ -15,2 +15,1 @@ "use strict"; | ||
exports.CrudCas = CrudCas; | ||
//# sourceMappingURL=CrudCas.js.map |
@@ -35,3 +35,3 @@ "use strict"; | ||
const blob = await this.crud.get(collection, resource); | ||
if (!(options === null || options === void 0 ? void 0 : options.skipVerification)) { | ||
if (!options?.skipVerification) { | ||
const digest = await this.hash(blob); | ||
@@ -59,2 +59,1 @@ if (!this.hashEqual(digest, hash)) | ||
exports.CrudCasBase = CrudCasBase; | ||
//# sourceMappingURL=CrudCasBase.js.map |
@@ -6,2 +6,1 @@ "use strict"; | ||
Object.defineProperty(exports, "CrudCas", { enumerable: true, get: function () { return CrudCas_1.CrudCas; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -13,2 +13,1 @@ "use strict"; | ||
exports.hashToLocation = hashToLocation; | ||
//# sourceMappingURL=util.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -11,2 +11,1 @@ "use strict"; | ||
exports.assertType = assertType; | ||
//# sourceMappingURL=util.js.map |
@@ -51,2 +51,1 @@ "use strict"; | ||
exports.default = Dirent; | ||
//# sourceMappingURL=Dirent.js.map |
@@ -20,2 +20,1 @@ "use strict"; | ||
exports.strToEncoding = strToEncoding; | ||
//# sourceMappingURL=encoding.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FsaCrud = void 0; | ||
const tslib_1 = require("tslib"); | ||
const util_1 = require("../node-to-fsa/util"); | ||
@@ -16,3 +15,3 @@ const util_2 = require("../crud/util"); | ||
let file; | ||
switch (options === null || options === void 0 ? void 0 : options.throwIf) { | ||
switch (options?.throwIf) { | ||
case 'exists': { | ||
@@ -91,3 +90,2 @@ try { | ||
this.drop = async (collection, silent) => { | ||
var _a, e_1, _b, _c; | ||
(0, util_2.assertType)(collection, 'drop', 'crudfs'); | ||
@@ -101,17 +99,4 @@ try { | ||
const root = await this.root; | ||
try { | ||
for (var _d = true, _e = tslib_1.__asyncValues(root.keys()), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { | ||
_c = _f.value; | ||
_d = false; | ||
const name = _c; | ||
await root.removeEntry(name, { recursive: true }); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = _e.return)) await _b.call(_e); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
for await (const name of root.keys()) | ||
await root.removeEntry(name, { recursive: true }); | ||
} | ||
@@ -124,53 +109,24 @@ } | ||
}; | ||
this.scan = function (collection) { | ||
return tslib_1.__asyncGenerator(this, arguments, function* () { | ||
var _a, e_2, _b, _c; | ||
(0, util_2.assertType)(collection, 'scan', 'crudfs'); | ||
const [dir] = yield tslib_1.__await(this.getDir(collection, false)); | ||
try { | ||
for (var _d = true, _e = tslib_1.__asyncValues(dir.entries()), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) { | ||
_c = _f.value; | ||
_d = false; | ||
const [id, handle] = _c; | ||
if (handle.kind === 'file') { | ||
yield yield tslib_1.__await({ | ||
type: 'resource', | ||
id, | ||
}); | ||
} | ||
else if (handle.kind === 'directory') { | ||
yield yield tslib_1.__await({ | ||
type: 'collection', | ||
id, | ||
}); | ||
} | ||
} | ||
this.scan = async function* (collection) { | ||
(0, util_2.assertType)(collection, 'scan', 'crudfs'); | ||
const [dir] = await this.getDir(collection, false); | ||
for await (const [id, handle] of dir.entries()) { | ||
if (handle.kind === 'file') { | ||
yield { | ||
type: 'resource', | ||
id, | ||
}; | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e)); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
else if (handle.kind === 'directory') { | ||
yield { | ||
type: 'collection', | ||
id, | ||
}; | ||
} | ||
}); | ||
} | ||
}; | ||
this.list = async (collection) => { | ||
var _a, e_3, _b, _c; | ||
const entries = []; | ||
try { | ||
for (var _d = true, _e = tslib_1.__asyncValues(this.scan(collection)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { | ||
_c = _f.value; | ||
_d = false; | ||
const entry = _c; | ||
entries.push(entry); | ||
} | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = _e.return)) await _b.call(_e); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
for await (const entry of this.scan(collection)) | ||
entries.push(entry); | ||
return entries; | ||
@@ -215,2 +171,1 @@ }; | ||
exports.FsaCrud = FsaCrud; | ||
//# sourceMappingURL=FsaCrud.js.map |
@@ -6,2 +6,1 @@ "use strict"; | ||
Object.defineProperty(exports, "FsaCrud", { enumerable: true, get: function () { return FsaCrud_1.FsaCrud; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -12,2 +12,1 @@ "use strict"; | ||
exports.newMissingError = newMissingError; | ||
//# sourceMappingURL=util.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=constants.js.map |
@@ -190,2 +190,1 @@ "use strict"; | ||
FsaNodeCore.fd = 0x7fffffff; | ||
//# sourceMappingURL=FsaNodeCore.js.map |
@@ -32,2 +32,1 @@ "use strict"; | ||
exports.FsaNodeDirent = FsaNodeDirent; | ||
//# sourceMappingURL=FsaNodeDirent.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FsaNodeFs = void 0; | ||
const tslib_1 = require("tslib"); | ||
const optHelpers = require("../node/options"); | ||
@@ -95,3 +94,3 @@ const util = require("../node/util"); | ||
} | ||
catch (_a) { } | ||
catch { } | ||
} | ||
@@ -167,3 +166,3 @@ })() | ||
} | ||
catch (_a) { } | ||
catch { } | ||
} | ||
@@ -300,3 +299,3 @@ })().then(() => cb(null), error => cb(error)); | ||
} | ||
catch (_a) { | ||
catch { | ||
throw util.createError('EACCESS', 'access', filename); | ||
@@ -346,21 +345,8 @@ } | ||
.then(dir => (async () => { | ||
var _a, e_1, _b, _c, _d, e_2, _e, _f; | ||
if (options.withFileTypes) { | ||
const list = []; | ||
try { | ||
for (var _g = true, _h = tslib_1.__asyncValues(dir.entries()), _j; _j = await _h.next(), _a = _j.done, !_a; _g = true) { | ||
_c = _j.value; | ||
_g = false; | ||
const [name, handle] = _c; | ||
const dirent = new FsaNodeDirent_1.FsaNodeDirent(name, handle.kind); | ||
list.push(dirent); | ||
} | ||
for await (const [name, handle] of dir.entries()) { | ||
const dirent = new FsaNodeDirent_1.FsaNodeDirent(name, handle.kind); | ||
list.push(dirent); | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_g && !_a && (_b = _h.return)) await _b.call(_h); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
if (!util.isWin && options.encoding !== 'buffer') | ||
@@ -378,17 +364,4 @@ list.sort((a, b) => { | ||
const list = []; | ||
try { | ||
for (var _k = true, _l = tslib_1.__asyncValues(dir.keys()), _m; _m = await _l.next(), _d = _m.done, !_d; _k = true) { | ||
_f = _m.value; | ||
_k = false; | ||
const key = _f; | ||
list.push(key); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_k && !_d && (_e = _l.return)) await _e.call(_l); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
for await (const key of dir.keys()) | ||
list.push(key); | ||
if (!util.isWin && options.encoding !== 'buffer') | ||
@@ -445,3 +418,2 @@ list.sort(); | ||
this.mkdir = (path, a, b) => { | ||
var _a; | ||
const opts = optHelpers.getMkdirOptions(a); | ||
@@ -453,3 +425,3 @@ const callback = util.validateCallback(typeof a === 'function' ? a : b); | ||
// TODO: need to throw if directory already exists | ||
this.getDir(folder, (_a = opts.recursive) !== null && _a !== void 0 ? _a : false) | ||
this.getDir(folder, opts.recursive ?? false) | ||
.then(dir => dir.getDirectoryHandle(name, { create: true })) | ||
@@ -491,3 +463,3 @@ .then(() => callback(null), error => { | ||
.then(dir => dir.getDirectoryHandle(name).then(() => dir)) | ||
.then(dir => { var _a; return dir.removeEntry(name, { recursive: (_a = options.recursive) !== null && _a !== void 0 ? _a : false }); }) | ||
.then(dir => dir.removeEntry(name, { recursive: options.recursive ?? false })) | ||
.then(() => callback(null), error => { | ||
@@ -517,3 +489,3 @@ if (error && typeof error === 'object') { | ||
this.getDir(folder, false, 'rmdir') | ||
.then(dir => { var _a; return dir.removeEntry(name, { recursive: (_a = options.recursive) !== null && _a !== void 0 ? _a : false }); }) | ||
.then(dir => dir.removeEntry(name, { recursive: options.recursive ?? false })) | ||
.then(() => callback(null), error => { | ||
@@ -560,3 +532,2 @@ if (options.force) { | ||
this.createWriteStream = (path, options) => { | ||
var _a; | ||
const defaults = { | ||
@@ -570,3 +541,3 @@ encoding: 'utf8', | ||
const filename = util.pathToFilename(path); | ||
const flags = util.flagsToNumber((_a = optionsObj.flags) !== null && _a !== void 0 ? _a : 'w'); | ||
const flags = util.flagsToNumber(optionsObj.flags ?? 'w'); | ||
const fd = optionsObj.fd ? (typeof optionsObj.fd === 'number' ? optionsObj.fd : optionsObj.fd.fd) : 0; | ||
@@ -624,3 +595,2 @@ const handle = fd ? this.getFileByFdAsync(fd) : this.__open(filename, flags, 0); | ||
this.statSync = (path, options) => { | ||
var _a; | ||
const { bigint = true, throwIfNoEntry = true } = optHelpers.getStatOptions(options); | ||
@@ -631,3 +601,3 @@ const filename = util.pathToFilename(path); | ||
const res = adapter.call('stat', location); | ||
const stats = new FsaNodeStats_1.FsaNodeStats(bigint, (_a = res.size) !== null && _a !== void 0 ? _a : 0, res.kind); | ||
const stats = new FsaNodeStats_1.FsaNodeStats(bigint, res.size ?? 0, res.kind); | ||
return stats; | ||
@@ -685,3 +655,3 @@ }; | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -849,19 +819,6 @@ } | ||
(async () => { | ||
var _a, e_3, _b, _c; | ||
const root = await this.root; | ||
try { | ||
for (var _d = true, _e = tslib_1.__asyncValues(root.keys()), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { | ||
_c = _f.value; | ||
_d = false; | ||
const name = _c; | ||
await root.removeEntry(name, { recursive: true }); | ||
} | ||
for await (const name of root.keys()) { | ||
await root.removeEntry(name, { recursive: true }); | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = _e.return)) await _b.call(_e); | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
})().then(() => callback(null), error => callback(error)); | ||
@@ -871,2 +828,1 @@ } | ||
exports.FsaNodeFs = FsaNodeFs; | ||
//# sourceMappingURL=FsaNodeFs.js.map |
@@ -34,2 +34,1 @@ "use strict"; | ||
exports.FsaNodeFsOpenFile = FsaNodeFsOpenFile; | ||
//# sourceMappingURL=FsaNodeFsOpenFile.js.map |
@@ -90,2 +90,1 @@ "use strict"; | ||
exports.FsaNodeReadStream = FsaNodeReadStream; | ||
//# sourceMappingURL=FsaNodeReadStream.js.map |
@@ -53,2 +53,1 @@ "use strict"; | ||
exports.FsaNodeStats = FsaNodeStats; | ||
//# sourceMappingURL=FsaNodeStats.js.map |
@@ -50,3 +50,2 @@ "use strict"; | ||
(async () => { | ||
var _a, _b; | ||
const fsaHandle = await handle; | ||
@@ -56,7 +55,7 @@ const fileWasOpened = !options.fd; | ||
this.emit('open', fsaHandle.fd); | ||
const flags = (0, util_1.flagsToNumber)((_a = options.flags) !== null && _a !== void 0 ? _a : 'w'); | ||
const flags = (0, util_1.flagsToNumber)(options.flags ?? 'w'); | ||
const keepExistingData = flags & 1024 /* FLAG.O_APPEND */ ? true : false; | ||
const writable = await fsaHandle.file.createWritable({ keepExistingData }); | ||
if (keepExistingData) { | ||
const start = Number((_b = options.start) !== null && _b !== void 0 ? _b : 0); | ||
const start = Number(options.start ?? 0); | ||
if (start) | ||
@@ -153,2 +152,1 @@ await writable.seek(start); | ||
exports.FsaNodeWriteStream = FsaNodeWriteStream; | ||
//# sourceMappingURL=FsaNodeWriteStream.js.map |
@@ -8,2 +8,1 @@ "use strict"; | ||
Object.defineProperty(exports, "FsaNodeSyncAdapterWorker", { enumerable: true, get: function () { return FsaNodeSyncAdapterWorker_1.FsaNodeSyncAdapterWorker; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -8,2 +8,1 @@ "use strict"; | ||
exports.decoder = new CborDecoder_1.CborDecoder(); | ||
//# sourceMappingURL=json.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -23,3 +23,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -35,2 +35,1 @@ } | ||
exports.testDirectoryIsWritable = testDirectoryIsWritable; | ||
//# sourceMappingURL=util.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=constants.js.map |
@@ -62,2 +62,1 @@ "use strict"; | ||
exports.FsaNodeSyncAdapterWorker = FsaNodeSyncAdapterWorker; | ||
//# sourceMappingURL=FsaNodeSyncAdapterWorker.js.map |
@@ -58,3 +58,3 @@ "use strict"; | ||
readFile: async ([filename, opts]) => { | ||
const buf = (await this.fs.promises.readFile(filename, Object.assign(Object.assign({}, opts), { encoding: 'buffer' }))); | ||
const buf = (await this.fs.promises.readFile(filename, { ...opts, encoding: 'buffer' })); | ||
const uint8 = new Uint8Array(buf, buf.byteOffset, buf.byteLength); | ||
@@ -64,6 +64,6 @@ return uint8; | ||
writeFile: async ([filename, data, opts]) => { | ||
await this.fs.promises.writeFile(filename, data, Object.assign(Object.assign({}, opts), { encoding: 'buffer' })); | ||
await this.fs.promises.writeFile(filename, data, { ...opts, encoding: 'buffer' }); | ||
}, | ||
appendFile: async ([filename, data, opts]) => { | ||
await this.fs.promises.appendFile(filename, data, Object.assign(Object.assign({}, opts), { encoding: 'buffer' })); | ||
await this.fs.promises.appendFile(filename, data, { ...opts, encoding: 'buffer' }); | ||
}, | ||
@@ -178,2 +178,1 @@ copy: async ([src, dst, flags]) => { | ||
exports.FsaNodeSyncWorker = FsaNodeSyncWorker; | ||
//# sourceMappingURL=FsaNodeSyncWorker.js.map |
@@ -66,3 +66,3 @@ "use strict"; | ||
} | ||
catch (_a) { } | ||
catch { } | ||
this.serveAsync(callback); | ||
@@ -73,2 +73,1 @@ })().catch(() => { }); | ||
exports.SyncMessenger = SyncMessenger; | ||
//# sourceMappingURL=SyncMessenger.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -50,4 +50,3 @@ "use strict"; | ||
exports.memfs = memfs; | ||
module.exports = Object.assign(Object.assign({}, module.exports), exports.fs); | ||
module.exports = { ...module.exports, ...exports.fs }; | ||
module.exports.semantic = true; | ||
//# sourceMappingURL=index.js.map |
@@ -13,2 +13,1 @@ "use strict"; | ||
exports.bufferFrom = bufferFrom; | ||
//# sourceMappingURL=buffer.js.map |
@@ -236,2 +236,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=errors.js.map |
@@ -6,2 +6,1 @@ "use strict"; | ||
Object.defineProperty(exports, "NodeCrud", { enumerable: true, get: function () { return NodeCrud_1.NodeCrud; } }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NodeCrud = void 0; | ||
const tslib_1 = require("tslib"); | ||
const util_1 = require("../node-to-fsa/util"); | ||
@@ -10,3 +9,2 @@ const util_2 = require("../crud/util"); | ||
constructor(options) { | ||
var _a; | ||
this.options = options; | ||
@@ -21,3 +19,3 @@ this.put = async (collection, id, data, options) => { | ||
const filename = dir + id; | ||
switch (options === null || options === void 0 ? void 0 : options.throwIf) { | ||
switch (options?.throwIf) { | ||
case 'exists': { | ||
@@ -158,54 +156,25 @@ try { | ||
}; | ||
this.scan = function (collection) { | ||
return tslib_1.__asyncGenerator(this, arguments, function* () { | ||
var _a, e_1, _b, _c; | ||
(0, util_2.assertType)(collection, 'scan', 'crudfs'); | ||
const dir = yield tslib_1.__await(this.checkDir(collection)); | ||
const dirents = (yield tslib_1.__await(this.fs.readdir(dir, { withFileTypes: true }))); | ||
try { | ||
for (var _d = true, dirents_1 = tslib_1.__asyncValues(dirents), dirents_1_1; dirents_1_1 = yield tslib_1.__await(dirents_1.next()), _a = dirents_1_1.done, !_a; _d = true) { | ||
_c = dirents_1_1.value; | ||
_d = false; | ||
const entry = _c; | ||
if (entry.isFile()) { | ||
yield yield tslib_1.__await({ | ||
type: 'resource', | ||
id: '' + entry.name, | ||
}); | ||
} | ||
else if (entry.isDirectory()) { | ||
yield yield tslib_1.__await({ | ||
type: 'collection', | ||
id: '' + entry.name, | ||
}); | ||
} | ||
} | ||
this.scan = async function* (collection) { | ||
(0, util_2.assertType)(collection, 'scan', 'crudfs'); | ||
const dir = await this.checkDir(collection); | ||
const dirents = (await this.fs.readdir(dir, { withFileTypes: true })); | ||
for await (const entry of dirents) { | ||
if (entry.isFile()) { | ||
yield { | ||
type: 'resource', | ||
id: '' + entry.name, | ||
}; | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = dirents_1.return)) yield tslib_1.__await(_b.call(dirents_1)); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
else if (entry.isDirectory()) { | ||
yield { | ||
type: 'collection', | ||
id: '' + entry.name, | ||
}; | ||
} | ||
}); | ||
} | ||
}; | ||
this.list = async (collection) => { | ||
var _a, e_2, _b, _c; | ||
const entries = []; | ||
try { | ||
for (var _d = true, _e = tslib_1.__asyncValues(this.scan(collection)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) { | ||
_c = _f.value; | ||
_d = false; | ||
const entry = _c; | ||
entries.push(entry); | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = _e.return)) await _b.call(_e); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
for await (const entry of this.scan(collection)) | ||
entries.push(entry); | ||
return entries; | ||
@@ -226,3 +195,3 @@ }; | ||
}; | ||
this.separator = (_a = options.separator) !== null && _a !== void 0 ? _a : '/'; | ||
this.separator = options.separator ?? '/'; | ||
let dir = options.dir; | ||
@@ -257,2 +226,1 @@ const last = dir[dir.length - 1]; | ||
exports.NodeCrud = NodeCrud; | ||
//# sourceMappingURL=NodeCrud.js.map |
@@ -14,2 +14,1 @@ "use strict"; | ||
exports.nodeToFsa = nodeToFsa; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NodeFileSystemDirectoryHandle = void 0; | ||
const tslib_1 = require("tslib"); | ||
const NodeFileSystemHandle_1 = require("./NodeFileSystemHandle"); | ||
@@ -24,8 +23,6 @@ const util_1 = require("./util"); | ||
*/ | ||
keys() { | ||
return tslib_1.__asyncGenerator(this, arguments, function* keys_1() { | ||
const list = yield tslib_1.__await(this.fs.promises.readdir(this.__path)); | ||
for (const name of list) | ||
yield yield tslib_1.__await('' + name); | ||
}); | ||
async *keys() { | ||
const list = await this.fs.promises.readdir(this.__path); | ||
for (const name of list) | ||
yield '' + name; | ||
} | ||
@@ -35,16 +32,14 @@ /** | ||
*/ | ||
entries() { | ||
return tslib_1.__asyncGenerator(this, arguments, function* entries_1() { | ||
const { __path: path, fs, ctx } = this; | ||
const list = yield tslib_1.__await(fs.promises.readdir(path, { withFileTypes: true })); | ||
for (const d of list) { | ||
const dirent = d; | ||
const name = dirent.name + ''; | ||
const newPath = path + name; | ||
if (dirent.isDirectory()) | ||
yield yield tslib_1.__await([name, new NodeFileSystemDirectoryHandle(fs, newPath, ctx)]); | ||
else if (dirent.isFile()) | ||
yield yield tslib_1.__await([name, new NodeFileSystemFileHandle_1.NodeFileSystemFileHandle(fs, newPath, ctx)]); | ||
} | ||
}); | ||
async *entries() { | ||
const { __path: path, fs, ctx } = this; | ||
const list = await fs.promises.readdir(path, { withFileTypes: true }); | ||
for (const d of list) { | ||
const dirent = d; | ||
const name = dirent.name + ''; | ||
const newPath = path + name; | ||
if (dirent.isDirectory()) | ||
yield [name, new NodeFileSystemDirectoryHandle(fs, newPath, ctx)]; | ||
else if (dirent.isFile()) | ||
yield [name, new NodeFileSystemFileHandle_1.NodeFileSystemFileHandle(fs, newPath, ctx)]; | ||
} | ||
} | ||
@@ -57,21 +52,5 @@ /** | ||
*/ | ||
values() { | ||
return tslib_1.__asyncGenerator(this, arguments, function* values_1() { | ||
var _a, e_1, _b, _c; | ||
try { | ||
for (var _d = true, _e = tslib_1.__asyncValues(this.entries()), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) { | ||
_c = _f.value; | ||
_d = false; | ||
const [, value] = _c; | ||
yield yield tslib_1.__await(value); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e)); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
}); | ||
async *values() { | ||
for await (const [, value] of this.entries()) | ||
yield value; | ||
} | ||
@@ -103,3 +82,3 @@ /** | ||
case 'ENOENT': { | ||
if (options === null || options === void 0 ? void 0 : options.create) { | ||
if (options?.create) { | ||
(0, util_1.assertCanWrite)(this.ctx.mode); | ||
@@ -143,3 +122,3 @@ await this.fs.promises.mkdir(filename); | ||
case 'ENOENT': { | ||
if (options === null || options === void 0 ? void 0 : options.create) { | ||
if (options?.create) { | ||
(0, util_1.assertCanWrite)(this.ctx.mode); | ||
@@ -230,2 +209,1 @@ await this.fs.promises.writeFile(filename, ''); | ||
exports.NodeFileSystemDirectoryHandle = NodeFileSystemDirectoryHandle; | ||
//# sourceMappingURL=NodeFileSystemDirectoryHandle.js.map |
@@ -62,2 +62,1 @@ "use strict"; | ||
exports.NodeFileSystemFileHandle = NodeFileSystemFileHandle; | ||
//# sourceMappingURL=NodeFileSystemFileHandle.js.map |
@@ -43,2 +43,1 @@ "use strict"; | ||
exports.NodeFileSystemHandle = NodeFileSystemHandle; | ||
//# sourceMappingURL=NodeFileSystemHandle.js.map |
@@ -40,6 +40,5 @@ "use strict"; | ||
async read(buffer, options = {}) { | ||
var _a; | ||
const buf = buffer instanceof ArrayBuffer ? buffer_1.Buffer.from(buffer) : buffer; | ||
try { | ||
const size = this.fs.readSync(this.fd, buf, 0, buffer.byteLength, (_a = options.at) !== null && _a !== void 0 ? _a : 0); | ||
const size = this.fs.readSync(this.fd, buf, 0, buffer.byteLength, options.at ?? 0); | ||
return size; | ||
@@ -77,7 +76,6 @@ } | ||
async write(buffer, options = {}) { | ||
var _a; | ||
(0, util_1.assertCanWrite)(this.ctx.mode); | ||
const buf = buffer instanceof ArrayBuffer ? buffer_1.Buffer.from(buffer) : buffer; | ||
try { | ||
return this.fs.writeSync(this.fd, buf, 0, buffer.byteLength, (_a = options.at) !== null && _a !== void 0 ? _a : 0); | ||
return this.fs.writeSync(this.fd, buf, 0, buffer.byteLength, options.at ?? 0); | ||
} | ||
@@ -99,2 +97,1 @@ catch (error) { | ||
exports.NodeFileSystemSyncAccessHandle = NodeFileSystemSyncAccessHandle; | ||
//# sourceMappingURL=NodeFileSystemSyncAccessHandle.js.map |
@@ -172,2 +172,1 @@ "use strict"; | ||
exports.NodeFileSystemWritableFileStream = NodeFileSystemWritableFileStream; | ||
//# sourceMappingURL=NodeFileSystemWritableFileStream.js.map |
@@ -14,2 +14,1 @@ "use strict"; | ||
exports.NodePermissionStatus = NodePermissionStatus; | ||
//# sourceMappingURL=NodePermissionStatus.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -8,3 +8,8 @@ "use strict"; | ||
const ctx = (partial = {}) => { | ||
return Object.assign({ separator: '/', syncHandleAllowed: false, mode: 'read' }, partial); | ||
return { | ||
separator: '/', | ||
syncHandleAllowed: false, | ||
mode: 'read', | ||
...partial, | ||
}; | ||
}; | ||
@@ -37,2 +42,1 @@ exports.ctx = ctx; | ||
exports.newNotAllowedError = newNotAllowedError; | ||
//# sourceMappingURL=util.js.map |
@@ -10,4 +10,4 @@ "use strict"; | ||
const { S_IFMT, S_IFDIR, S_IFREG, S_IFLNK, O_APPEND } = constants_1.constants; | ||
const getuid = () => { var _a, _b; return (_b = (_a = process_1.default.getuid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; }; | ||
const getgid = () => { var _a, _b; return (_b = (_a = process_1.default.getgid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; }; | ||
const getuid = () => process_1.default.getuid?.() ?? 0; | ||
const getgid = () => process_1.default.getgid?.() ?? 0; | ||
exports.SEP = '/'; | ||
@@ -256,3 +256,3 @@ /** | ||
} | ||
link === null || link === void 0 ? void 0 : link.syncSteps(); | ||
link?.syncSteps(); | ||
} | ||
@@ -434,2 +434,1 @@ } | ||
exports.File = File; | ||
//# sourceMappingURL=node.js.map |
@@ -57,2 +57,1 @@ "use strict"; | ||
})(FLAGS || (exports.FLAGS = FLAGS = {})); | ||
//# sourceMappingURL=constants.js.map |
@@ -57,2 +57,1 @@ "use strict"; | ||
exports.FileHandle = FileHandle; | ||
//# sourceMappingURL=FileHandle.js.map |
@@ -54,2 +54,1 @@ "use strict"; | ||
exports.FsPromises = FsPromises; | ||
//# sourceMappingURL=FsPromises.js.map |
@@ -49,2 +49,1 @@ "use strict"; | ||
]; | ||
//# sourceMappingURL=fsCallbackApiList.js.map |
@@ -19,2 +19,1 @@ "use strict"; | ||
]; | ||
//# sourceMappingURL=fsCommonObjectsList.js.map |
@@ -47,2 +47,1 @@ "use strict"; | ||
]; | ||
//# sourceMappingURL=fsSynchronousApiList.js.map |
@@ -96,2 +96,1 @@ "use strict"; | ||
exports.getWriteFileOptions = optsGenerator(exports.writeFileDefaults); | ||
//# sourceMappingURL=options.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=FsCallbackApi.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=FsCommonObjects.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=FsPromisesApi.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=FsSynchronousApi.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=misc.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=options.js.map |
@@ -313,2 +313,1 @@ "use strict"; | ||
exports.unixify = unixify; | ||
//# sourceMappingURL=util.js.map |
@@ -7,3 +7,2 @@ "use strict"; | ||
const toTreeSync = (fs, opts = {}) => { | ||
var _a; | ||
const separator = opts.separator || '/'; | ||
@@ -14,3 +13,3 @@ let dir = opts.dir || separator; | ||
const tab = opts.tab || ''; | ||
const depth = (_a = opts.depth) !== null && _a !== void 0 ? _a : 10; | ||
const depth = opts.depth ?? 10; | ||
let subtree = ' (...)'; | ||
@@ -35,2 +34,1 @@ if (depth > 0) { | ||
exports.toTreeSync = toTreeSync; | ||
//# sourceMappingURL=index.js.map |
@@ -22,3 +22,3 @@ "use strict"; | ||
} | ||
catch (_a) { | ||
catch { | ||
return undefined; | ||
@@ -42,2 +42,1 @@ } | ||
exports.default = createProcess(); | ||
//# sourceMappingURL=process.js.map |
@@ -6,2 +6,1 @@ "use strict"; | ||
.catch(() => { })); | ||
//# sourceMappingURL=queueMicrotask.js.map |
@@ -9,2 +9,1 @@ "use strict"; | ||
exports.default = _setImmediate; | ||
//# sourceMappingURL=setImmediate.js.map |
@@ -14,2 +14,1 @@ "use strict"; | ||
exports.default = setTimeoutUnref; | ||
//# sourceMappingURL=setTimeoutUnref.js.map |
@@ -59,2 +59,1 @@ "use strict"; | ||
exports.fromSnapshot = fromSnapshot; | ||
//# sourceMappingURL=async.js.map |
@@ -31,2 +31,1 @@ "use strict"; | ||
exports.fromBinarySnapshot = fromBinarySnapshot; | ||
//# sourceMappingURL=binary.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=constants.js.map |
@@ -8,2 +8,1 @@ "use strict"; | ||
tslib_1.__exportStar(require("./json"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -31,2 +31,1 @@ "use strict"; | ||
exports.fromJsonSnapshot = fromJsonSnapshot; | ||
//# sourceMappingURL=json.js.map |
@@ -6,2 +6,1 @@ "use strict"; | ||
exports.writer = new Writer_1.Writer(1024 * 32); | ||
//# sourceMappingURL=shared.js.map |
@@ -59,2 +59,1 @@ "use strict"; | ||
exports.fromSnapshotSync = fromSnapshotSync; | ||
//# sourceMappingURL=sync.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -72,2 +72,1 @@ "use strict"; | ||
exports.default = Stats; | ||
//# sourceMappingURL=Stats.js.map |
@@ -42,2 +42,1 @@ "use strict"; | ||
exports.concurrency = concurrency; | ||
//# sourceMappingURL=concurrency.js.map |
@@ -25,2 +25,1 @@ "use strict"; | ||
exports.Defer = Defer; | ||
//# sourceMappingURL=Defer.js.map |
@@ -9,2 +9,1 @@ "use strict"; | ||
exports.go = go; | ||
//# sourceMappingURL=go.js.map |
@@ -8,2 +8,1 @@ "use strict"; | ||
tslib_1.__exportStar(require("./of"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -22,2 +22,1 @@ "use strict"; | ||
exports.of = of; | ||
//# sourceMappingURL=of.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
@@ -74,2 +74,1 @@ "use strict"; | ||
exports.createVolume = createVolume; | ||
//# sourceMappingURL=volume-localstorage.js.map |
@@ -22,2 +22,1 @@ "use strict"; | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "memfs", | ||
"version": "4.9.1", | ||
"version": "5.0.0-next.1", | ||
"description": "In-memory file-system with Node's fs API.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
405763
176
9712
1