Socket
Socket
Sign inDemoInstall

@platform/fs

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platform/fs - npm Package Compare versions

Comparing version 0.5.24 to 0.5.25

.DS_Store

2

lib/common/libs.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fs = exports.yaml = void 0;
exports.dirname = exports.extname = exports.basename = exports.resolve = exports.join = exports.fs = exports.yaml = void 0;
var yaml = require("js-yaml");

@@ -5,0 +5,0 @@ exports.yaml = yaml;

export * from '@platform/fs.types/lib/types';
export { Json } from '@platform/types';
/// <reference types="node" />
import * as fsExtra from 'fs-extra';
import * as path from 'path';
import { t } from '../common';
import { glob } from '../glob';

@@ -16,3 +15,8 @@ import { is } from '../is';

exists: (path: string) => Promise<boolean>;
writeFile: (path: string, data: any, options?: string | t.IFsWriteFileOptions | undefined) => Promise<void>;
path: path.PlatformPath;
join: (...paths: string[]) => string;
resolve: (...pathSegments: string[]) => string;
dirname: (p: string) => string;
basename: (p: string, ext?: string | undefined) => string;
extname: (p: string) => string;
size: {

@@ -44,8 +48,2 @@ toString(input: number | Buffer, options?: import("../size").IFileSizeStringOptions | undefined): string;

unzip: typeof unzip;
path: path.PlatformPath;
join: (...paths: string[]) => string;
resolve: (...pathSegments: string[]) => string;
dirname: (p: string) => string;
basename: (p: string, ext?: string | undefined) => string;
extname: (p: string) => string;
copy(src: string, dest: string, options?: fsExtra.CopyOptions | undefined): Promise<void>;

@@ -254,2 +252,5 @@ copy(src: string, dest: string, callback: (err: Error) => void): void;

}>;
writeFile(file: string | number | Buffer | import("url").URL, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
writeFile(file: string | number | Buffer | import("url").URL, data: any, options?: string | fsExtra.WriteFileOptions | undefined): Promise<void>;
writeFile(file: string | number | Buffer | import("url").URL, data: any, options: string | fsExtra.WriteFileOptions, callback: (err: NodeJS.ErrnoException) => void): void;
writev(fd: number, buffers: NodeJS.ArrayBufferView[], position: number, cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void): void;

@@ -262,2 +263,4 @@ writev(fd: number, buffers: NodeJS.ArrayBufferView[], cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void): void;

createLinkSync: typeof fsExtra.ensureLinkSync;
emptydir: typeof fsExtra.emptyDir;
emptydirSync: typeof fsExtra.emptyDirSync;
renameSync(oldPath: fsExtra.PathLike, newPath: fsExtra.PathLike): void;

@@ -269,2 +272,4 @@ truncateSync(path: fsExtra.PathLike, len?: number | null | undefined): void;

lchownSync(path: fsExtra.PathLike, uid: number, gid: number): void;
lutimes: typeof fsExtra.lutimes;
lutimesSync(path: fsExtra.PathLike, atime: string | number | Date, mtime: string | number | Date): void;
chmodSync(path: fsExtra.PathLike, mode: string | number): void;

@@ -287,2 +292,4 @@ fchmodSync(fd: number, mode: string | number): void;

rmdirSync(path: fsExtra.PathLike, options?: fsExtra.RmDirOptions | undefined): void;
rm: typeof fsExtra.rm;
rmSync(path: fsExtra.PathLike, options?: fsExtra.RmOptions | undefined): void;
mkdirSync(path: fsExtra.PathLike, options: fsExtra.MakeDirectoryOptions & {

@@ -387,5 +394,5 @@ recursive: true;

copyFileSync(src: fsExtra.PathLike, dest: fsExtra.PathLike, flags?: number | undefined): void;
writevSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number | undefined): number;
writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number | undefined): number;
readv: typeof fsExtra.readv;
readvSync(fd: number, buffers: NodeJS.ArrayBufferView[], position?: number | undefined): number;
readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number | undefined): number;
opendirSync(path: string, options?: fsExtra.OpenDirOptions | undefined): fsExtra.Dir;

@@ -392,0 +399,0 @@ promises: typeof fsExtra.promises;

@@ -20,5 +20,9 @@ "use strict";

var exists = function (path) { return fsExtra.pathExists(path); };
var writeFile = fsExtra.writeFile;
exports.fs = tslib_1.__assign(tslib_1.__assign({}, fsExtra), { exists: exists,
writeFile: writeFile,
path: path,
join: join,
resolve: resolve,
dirname: dirname,
basename: basename,
extname: extname,
size: size_1.size,

@@ -35,8 +39,2 @@ stream: stream_1.stream,

zip: zip_1.zip,
unzip: zip_1.unzip,
path: path,
join: join,
resolve: resolve,
dirname: dirname,
basename: basename,
extname: extname });
unzip: zip_1.unzip });

@@ -0,1 +1,2 @@

export declare function stream(input?: any): boolean;
export declare function dir(path: string): Promise<boolean>;

@@ -2,0 +3,0 @@ export declare function dirSync(path: string): boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeSync = exports.type = exports.fileSync = exports.file = exports.dirSync = exports.dir = void 0;
exports.typeSync = exports.type = exports.fileSync = exports.file = exports.dirSync = exports.dir = exports.stream = void 0;
var tslib_1 = require("tslib");
var common_1 = require("../common");
function stream(input) {
return typeof (input === null || input === void 0 ? void 0 : input.on) === 'function';
}
exports.stream = stream;
function dir(path) {

@@ -7,0 +11,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function () {

@@ -1,1 +0,2 @@

export declare function save(path: string, data: ReadableStream | string): Promise<void>;
import { t } from '../common';
export declare function save(path: string, data: ReadableStream | t.Json | string): Promise<void>;

@@ -12,7 +12,7 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var output, err_1;
var isStream, err_1;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 6, , 7]);
_a.trys.push([0, 9, , 10]);
return [4, fs_extra_1.ensureDir(path_1.dirname(path))];

@@ -25,14 +25,21 @@ case 1:

_a.sent();
return [3, 5];
return [2];
case 3:
output = fs_extra_1.createWriteStream(path);
return [4, pipeline(data, output)];
if (!(typeof data === 'object')) return [3, 8];
isStream = typeof data.on === 'function';
if (!isStream) return [3, 5];
return [4, pipeline(data, fs_extra_1.createWriteStream(path))];
case 4:
_a.sent();
_a.label = 5;
case 5: return [3, 7];
return [3, 7];
case 5: return [4, fs_extra_1.writeFile(path, JSON.stringify(data, null, ' '))];
case 6:
_a.sent();
_a.label = 7;
case 7: return [2];
case 8: throw new Error("Type of data not saveable (" + typeof data + ")");
case 9:
err_1 = _a.sent();
throw new Error("Failed to save stream to '" + path + "'. " + err_1.message);
case 7: return [2];
case 10: return [2];
}

@@ -39,0 +46,0 @@ });

{
"name": "@platform/fs",
"version": "0.5.24",
"version": "0.5.25",
"description": "POSIX style file-system tools.",

@@ -14,4 +14,5 @@ "main": "lib/index",

"dependencies": {
"@platform/fs.types": "0.0.16",
"@types/fs-extra": "9.0.2",
"@platform/fs.types": "0.0.17",
"@platform/types": "0.5.9",
"@types/fs-extra": "9.0.3",
"@types/js-yaml": "3.12.5",

@@ -28,4 +29,4 @@ "archiver": "5.0.2",

"devDependencies": {
"@platform/test": "0.1.16",
"@platform/ts.libs": "4.0.1",
"@platform/test": "0.1.17",
"@platform/ts.libs": "4.0.2",
"@types/archiver": "3.1.1",

@@ -32,0 +33,0 @@ "@types/dotenv": "8.2.0",

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