Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@meteor-it/fs

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meteor-it/fs - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

8

index.d.ts
/// <reference types="node" />
import { promises as fs, Stats } from 'fs';
declare type FileHandle = fs.FileHandle;
import fsNative, { Stats } from 'fs';
declare type FileHandle = fsNative.promises.FileHandle;
export interface IParsedDataUrl {

@@ -49,7 +49,7 @@ mime: string;

*/
export declare function getReadStream(path: string, options?: {}): import("fs").ReadStream;
export declare function getReadStream(path: string, options?: {}): fsNative.ReadStream;
/**
* Wrapper to fs function
*/
export declare function getWriteStream(path: string, options?: {}): import("fs").WriteStream;
export declare function getWriteStream(path: string, options?: {}): fsNative.WriteStream;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
const utils_1 = require("@meteor-it/utils");
const path_1 = require("path");
const { promises: fs, constants: fsConstants, createReadStream, createWriteStream } = fs_1.default;
const { sep } = path_1.default;
/**

@@ -27,3 +29,3 @@ * Returns true if path is a valid data url

async function readDir(dir) {
return await fs_1.promises.readdir(dir);
return await fs.readdir(dir);
}

@@ -38,15 +40,15 @@ exports.readDir = readDir;

return parseDataUrl(file).data;
return await fs_1.promises.readFile(file);
return await fs.readFile(file);
}
exports.readFile = readFile;
async function stat(file) {
return await fs_1.promises.stat(file);
return await fs.stat(file);
}
exports.stat = stat;
async function open(file, mode, access) {
return await fs_1.promises.open(file, mode, access);
return await fs.open(file, mode, access);
}
exports.open = open;
async function read(fd, buffer, offset, length, position) {
return await fs_1.promises.read(fd, buffer, offset, length, position);
return await fs.read(fd, buffer, offset, length, position);
}

@@ -58,3 +60,3 @@ exports.read = read;

async function writeFile(filename, text) {
return await fs_1.promises.writeFile(filename, text);
return await fs.writeFile(filename, text);
}

@@ -77,3 +79,3 @@ exports.writeFile = writeFile;

cb = (file, dir) => {
returnValue.push(dir + path_1.sep + file);
returnValue.push(dir + sep + file);
};

@@ -83,3 +85,3 @@ }

await utils_1.asyncEach(await readDir(dir), async (file) => {
let path = dir + path_1.sep + file;
let path = dir + sep + file;
if (await isFile(path)) {

@@ -93,3 +95,3 @@ cb(file, dir);

await utils_1.asyncEach(dirList, async (dirLevelDown) => {
await walkDir(dir + path_1.sep + dirLevelDown, cb);
await walkDir(dir + sep + dirLevelDown, cb);
});

@@ -107,3 +109,3 @@ if (shouldReturn) {

try {
let result = await fs_1.promises.access(file, fs_1.constants.F_OK);
let result = await fs.access(file, fsConstants.F_OK);
return result === undefined;

@@ -136,3 +138,3 @@ }

function getReadStream(path, options = {}) {
return fs_1.createReadStream(path, options);
return createReadStream(path, options);
}

@@ -144,6 +146,6 @@ exports.getReadStream = getReadStream;

function getWriteStream(path, options = {}) {
return fs_1.createWriteStream(path, options);
return createWriteStream(path, options);
}
exports.getWriteStream = getWriteStream;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInhyZXN0L25vZGVfbW9kdWxlcy9AbWV0ZW9yLWl0L2ZzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkJBQW9HO0FBQ3BHLDRDQUEyQztBQUMzQywrQkFBeUI7QUFHekI7OztHQUdHO0FBQ0gsU0FBUyxTQUFTLENBQUMsSUFBVztJQUM3QixPQUFPLHNCQUFzQixDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBQyxHQUFHLENBQUMsQ0FBQyxDQUFBO0FBQ3ZELENBQUM7QUFNRDs7O0dBR0c7QUFDSCxTQUFTLFlBQVksQ0FBQyxJQUFXO0lBQ2hDLE9BQU87UUFDTixJQUFJLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDLEVBQUMsSUFBSS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HBlciB0byBmcyBmdW5jdGlvblxuICovXG5leHBvcnQgZnVuY3Rpb24gZ2V0V3JpdGVTdHJlYW0ocGF0aDogc3RyaW5nLCBvcHRpb25zID0ge30pIHtcblx0cmV0dXJuIGNyZWF0ZVdyaXRlU3RyZWFtKHBhdGgsIG9wdGlvbnMpO1xufVxuIl19

@@ -1,6 +0,8 @@

import {promises as fs,Stats,constants as fsConstants,createReadStream,createWriteStream} from 'fs';
import {asyncEach} from '@meteor-it/utils';
import {sep} from 'path';
import fsNative, { Stats } from 'fs';
import path from 'path';
import { asyncEach } from '@meteor-it/utils';
type FileHandle = fs.FileHandle;
const { promises: fs, constants: fsConstants, createReadStream, createWriteStream } = fsNative;
const { sep } = path;
type FileHandle = fsNative.promises.FileHandle;
/**

@@ -10,7 +12,7 @@ * Returns true if path is a valid data url

*/
function isDataUrl(path:string):boolean{
return /^data:.+\/.+;base64,/.test(path.substr(0,268))
function isDataUrl(path: string): boolean {
return /^data:.+\/.+;base64,/.test(path.substr(0, 268))
}
export interface IParsedDataUrl{
export interface IParsedDataUrl {
mime: string,

@@ -23,6 +25,6 @@ data: Buffer

*/
function parseDataUrl(path:string):IParsedDataUrl{
function parseDataUrl(path: string): IParsedDataUrl {
return {
mime: path.slice(5,path.indexOf(';')),
data: Buffer.from(path.slice(path.indexOf(',')+1),'base64')
mime: path.slice(5, path.indexOf(';')),
data: Buffer.from(path.slice(path.indexOf(',') + 1), 'base64')
}

@@ -34,3 +36,3 @@ }

*/
export async function readDir (dir:string) {
export async function readDir(dir: string) {
return await fs.readdir(dir);

@@ -42,4 +44,4 @@ }

*/
export async function readFile (file:string):Promise<Buffer> {
if(isDataUrl(file))
export async function readFile(file: string): Promise<Buffer> {
if (isDataUrl(file))
return parseDataUrl(file).data;

@@ -49,11 +51,11 @@ return await fs.readFile(file);

export async function stat (file:string):Promise<Stats>{
export async function stat(file: string): Promise<Stats> {
return await fs.stat(file);
}
export async function open (file:string,mode:string,access:string):Promise<FileHandle>{
return await fs.open(file,mode,access);
export async function open(file: string, mode: string, access: string): Promise<FileHandle> {
return await fs.open(file, mode, access);
}
export async function read(fd: FileHandle, buffer:Buffer, offset:number, length:number, position:number){
export async function read(fd: FileHandle, buffer: Buffer, offset: number, length: number, position: number) {
return await fs.read(fd, buffer, offset, length, position);

@@ -65,3 +67,3 @@ }

*/
export async function writeFile (filename:string, text:string|Buffer) {
export async function writeFile(filename: string, text: string | Buffer) {
return await fs.writeFile(filename, text);

@@ -75,5 +77,5 @@ }

*/
export async function walkDir (dir:string, cb?:(file:string,dir:string)=>void):Promise<string[]|null> {
export async function walkDir(dir: string, cb?: (file: string, dir: string) => void): Promise<string[] | null> {
if (!await exists(dir)) { throw new Error('No such file or directory: ' + dir); }
let returnValue:string[];
let returnValue: string[];
let shouldReturn = false;

@@ -83,8 +85,8 @@ if (!cb) {

shouldReturn = true;
cb = (file:string, dir:string) => {
cb = (file: string, dir: string) => {
returnValue.push(dir + sep + file);
};
}
let dirList:string[] = [];
await asyncEach(await readDir(dir), async(file:string) => {
let dirList: string[] = [];
await asyncEach(await readDir(dir), async (file: string) => {
let path = dir + sep + file;

@@ -97,7 +99,7 @@ if (await isFile(path)) {

});
await asyncEach(dirList, async(dirLevelDown:string) => {
await asyncEach(dirList, async (dirLevelDown: string) => {
await walkDir(dir + sep + dirLevelDown, cb);
});
if (shouldReturn) {
return returnValue.sort();
return returnValue.sort();
}

@@ -110,8 +112,8 @@ return null;

*/
export async function exists (file:string):Promise<boolean> {
export async function exists(file: string): Promise<boolean> {
try {
let result = await fs.access(file, fsConstants.F_OK);
return result === undefined;
} catch (e) {
// Because only "err" field is returned if not exists
} catch (e) {
// Because only "err" field is returned if not exists
return false;

@@ -125,3 +127,3 @@ }

*/
export async function isFile (path:string): Promise<boolean> {
export async function isFile(path: string): Promise<boolean> {
return (await stat(path)).isFile();

@@ -132,3 +134,3 @@ }

*/
export async function isDirectory (path:string): Promise<boolean> {
export async function isDirectory(path: string): Promise<boolean> {
return (await stat(path)).isDirectory();

@@ -140,3 +142,3 @@ }

*/
export function getReadStream (path:string, options = {}) {
export function getReadStream(path: string, options = {}) {
return createReadStream(path, options);

@@ -148,4 +150,4 @@ }

*/
export function getWriteStream (path:string, options={}) {
export function getWriteStream(path: string, options = {}) {
return createWriteStream(path, options);
}
{
"name": "@meteor-it/fs",
"version": "1.1.2",
"version": "1.1.3",
"description": "Wrappers for native fs module",

@@ -14,3 +14,3 @@ "module": "index.mjs",

"dependencies": {
"@meteor-it/utils": "^1.3.12"
"@meteor-it/utils": "^1.3.13"
},

@@ -21,3 +21,3 @@ "sideEffects": false,

},
"gitHead": "888982e812786093e95b2103f646c34fdd32abc5"
"gitHead": "13a378ab6afab3cac18cd00dd670900bf81d4a3e"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc