@meteor-it/fs
Advanced tools
Comparing version 1.1.4 to 1.1.5
32
index.js
@@ -6,4 +6,2 @@ "use strict"; | ||
const utils_1 = require("@meteor-it/utils"); | ||
const { promises: fs, constants: fsConstants, createReadStream, createWriteStream } = fs_1.default; | ||
const { sep } = path_1.default; | ||
/** | ||
@@ -30,3 +28,3 @@ * Returns true if path is a valid data url | ||
async function readDir(dir) { | ||
return await fs.readdir(dir); | ||
return await fs_1.default.promises.readdir(dir); | ||
} | ||
@@ -41,15 +39,15 @@ exports.readDir = readDir; | ||
return parseDataUrl(file).data; | ||
return await fs.readFile(file); | ||
return await fs_1.default.promises.readFile(file); | ||
} | ||
exports.readFile = readFile; | ||
async function stat(file) { | ||
return await fs.stat(file); | ||
return await fs_1.default.promises.stat(file); | ||
} | ||
exports.stat = stat; | ||
async function open(file, mode, access) { | ||
return await fs.open(file, mode, access); | ||
return await fs_1.default.promises.open(file, mode, access); | ||
} | ||
exports.open = open; | ||
async function read(fd, buffer, offset, length, position) { | ||
return await fs.read(fd, buffer, offset, length, position); | ||
return await fs_1.default.promises.read(fd, buffer, offset, length, position); | ||
} | ||
@@ -61,3 +59,3 @@ exports.read = read; | ||
async function writeFile(filename, text) { | ||
return await fs.writeFile(filename, text); | ||
return await fs_1.default.promises.writeFile(filename, text); | ||
} | ||
@@ -80,3 +78,3 @@ exports.writeFile = writeFile; | ||
cb = (file, dir) => { | ||
returnValue.push(dir + sep + file); | ||
returnValue.push(dir + path_1.default.sep + file); | ||
}; | ||
@@ -86,7 +84,7 @@ } | ||
await utils_1.asyncEach(await readDir(dir), async (file) => { | ||
let path = dir + sep + file; | ||
if (await isFile(path)) { | ||
let pathStr = dir + path_1.default.sep + file; | ||
if (await isFile(pathStr)) { | ||
cb(file, dir); | ||
} | ||
else if (await isDirectory(path)) { | ||
else if (await isDirectory(pathStr)) { | ||
dirList.push(file); | ||
@@ -96,3 +94,3 @@ } | ||
await utils_1.asyncEach(dirList, async (dirLevelDown) => { | ||
await walkDir(dir + sep + dirLevelDown, cb); | ||
await walkDir(dir + path_1.default.sep + dirLevelDown, cb); | ||
}); | ||
@@ -110,3 +108,3 @@ if (shouldReturn) { | ||
try { | ||
let result = await fs.access(file, fsConstants.F_OK); | ||
let result = await fs_1.default.promises.access(file, fs_1.default.constants.F_OK); | ||
return result === undefined; | ||
@@ -139,3 +137,3 @@ } | ||
function getReadStream(path, options = {}) { | ||
return createReadStream(path, options); | ||
return fs_1.default.createReadStream(path, options); | ||
} | ||
@@ -147,6 +145,6 @@ exports.getReadStream = getReadStream; | ||
function getWriteStream(path, options = {}) { | ||
return createWriteStream(path, options); | ||
return fs_1.default.createWriteStream(path, options); | ||
} | ||
exports.getWriteStream = getWriteStream; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInhyZXN0L25vZGVfbW9kdWxlcy9AbWV0ZW9yLWl0L2ZzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkJBQXFDO0FBQ3JDLCtCQUF3QjtBQUN4Qiw0Q0FBNkM7QUFFN0MsTUFBTSxFQUFFLFFBQVEsRUFBRSxFQUFFLEVBQUUsU0FBUyxFQUFFLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxpQkFBaUIsRUFBRSxHQUFHLFlBQVEsQ0FBQztBQUMvRixNQUFNLEVBQUUsR0FBRyxFQUFFLEdBQUcsY0FBSSxDQUFDO0FBRXJCOzs7R0FHRztBQUNILFNBQVMsU0FBUyxDQUFDLElBQVk7SUFDOUIsT0FBTyxzQkFBc0IsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQTtBQUN4RCxDQUFDO0FBTUQ7OztHQUdHO0FBQ0gsU0FBUyxZQUFZLENBQUMsSUFBWTtJQUNqQyxPQUFPO1FBQ04sSUFBSSxFQUFFLElBQUksQ0FBQy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G9ydCBmdW5jdGlvbiBnZXRSZWFkU3RyZWFtKHBhdGg6IHN0cmluZywgb3B0aW9ucyA9IHt9KSB7XG5cdHJldHVybiBmc05hdGl2ZS5jcmVhdGVSZWFkU3RyZWFtKHBhdGgsIG9wdGlvbnMpO1xufVxuXG4vKipcbiAqIFdyYXBwZXIgdG8gZnMgZnVuY3Rpb25cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGdldFdyaXRlU3RyZWFtKHBhdGg6IHN0cmluZywgb3B0aW9ucyA9IHt9KSB7XG5cdHJldHVybiBmc05hdGl2ZS5jcmVhdGVXcml0ZVN0cmVhbShwYXRoLCBvcHRpb25zKTtcbn1cbiJdfQ== |
30
index.ts
@@ -5,4 +5,2 @@ import fsNative, { Stats } from 'fs'; | ||
const { promises: fs, constants: fsConstants, createReadStream, createWriteStream } = fsNative; | ||
const { sep } = path; | ||
type FileHandle = fsNative.promises.FileHandle; | ||
@@ -36,3 +34,3 @@ /** | ||
export async function readDir(dir: string) { | ||
return await fs.readdir(dir); | ||
return await fsNative.promises.readdir(dir); | ||
} | ||
@@ -46,15 +44,15 @@ /** | ||
return parseDataUrl(file).data; | ||
return await fs.readFile(file); | ||
return await fsNative.promises.readFile(file); | ||
} | ||
export async function stat(file: string): Promise<Stats> { | ||
return await fs.stat(file); | ||
return await fsNative.promises.stat(file); | ||
} | ||
export async function open(file: string, mode: string, access: string): Promise<FileHandle> { | ||
return await fs.open(file, mode, access); | ||
return await fsNative.promises.open(file, mode, access); | ||
} | ||
export async function read(fd: FileHandle, buffer: Buffer, offset: number, length: number, position: number) { | ||
return await fs.read(fd, buffer, offset, length, position); | ||
return await fsNative.promises.read(fd, buffer, offset, length, position); | ||
} | ||
@@ -66,3 +64,3 @@ | ||
export async function writeFile(filename: string, text: string | Buffer) { | ||
return await fs.writeFile(filename, text); | ||
return await fsNative.promises.writeFile(filename, text); | ||
} | ||
@@ -83,3 +81,3 @@ | ||
cb = (file: string, dir: string) => { | ||
returnValue.push(dir + sep + file); | ||
returnValue.push(dir + path.sep + file); | ||
}; | ||
@@ -89,6 +87,6 @@ } | ||
await asyncEach(await readDir(dir), async (file: string) => { | ||
let path = dir + sep + file; | ||
if (await isFile(path)) { | ||
let pathStr = dir + path.sep + file; | ||
if (await isFile(pathStr)) { | ||
cb(file, dir); | ||
} else if (await isDirectory(path)) { | ||
} else if (await isDirectory(pathStr)) { | ||
dirList.push(file); | ||
@@ -98,3 +96,3 @@ } | ||
await asyncEach(dirList, async (dirLevelDown: string) => { | ||
await walkDir(dir + sep + dirLevelDown, cb); | ||
await walkDir(dir + path.sep + dirLevelDown, cb); | ||
}); | ||
@@ -112,3 +110,3 @@ if (shouldReturn) { | ||
try { | ||
let result = await fs.access(file, fsConstants.F_OK); | ||
let result = await fsNative.promises.access(file, fsNative.constants.F_OK); | ||
return result === undefined; | ||
@@ -139,3 +137,3 @@ } catch (e) { | ||
export function getReadStream(path: string, options = {}) { | ||
return createReadStream(path, options); | ||
return fsNative.createReadStream(path, options); | ||
} | ||
@@ -147,3 +145,3 @@ | ||
export function getWriteStream(path: string, options = {}) { | ||
return createWriteStream(path, options); | ||
return fsNative.createWriteStream(path, options); | ||
} |
MIT License | ||
Copyright (c) 2017 Yaroslaw Bolyukin <iam@f6cf.pw> | ||
Copyright (c) 2016-2019 CertainLach <iam@lach.pw> | ||
@@ -9,2 +9,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "@meteor-it/fs", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Wrappers for native fs module", | ||
@@ -20,3 +20,3 @@ "module": "index.mjs", | ||
}, | ||
"gitHead": "6757ca3859d9bf61db6039a7be58afa5da07b66a" | ||
"gitHead": "4cf5ddb78afeda62243c0d3146d6f345075841cf" | ||
} |
Sorry, the diff of this file is not supported yet
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
33852
517