@platform/fs
Advanced tools
Comparing version 0.7.3 to 0.7.4
@@ -0,1 +1,3 @@ | ||
import * as t from './types'; | ||
export declare function defaultValue<T>(value: T | undefined, defaultValue?: T): T; | ||
export declare function stringify(input: t.Json): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defaultValue = void 0; | ||
exports.stringify = exports.defaultValue = void 0; | ||
function defaultValue(value, defaultValue) { | ||
@@ -8,1 +8,5 @@ return (value === undefined ? defaultValue : value); | ||
exports.defaultValue = defaultValue; | ||
function stringify(input) { | ||
return JSON.stringify(input, null, ' ') + "\n"; | ||
} | ||
exports.stringify = stringify; |
/// <reference types="node" /> | ||
import * as path from 'path'; | ||
import { t } from './common'; | ||
import { is } from './is'; | ||
@@ -9,5 +10,4 @@ import { merge } from './merge'; | ||
import { env } from './env'; | ||
import { stream } from './stream'; | ||
import { sort } from './sort'; | ||
import { readdir, readdirSync, ensureDir, ensureDirSync, writeFile, writeFileSync, readFile, readFileSync, move, moveSync, copy, copySync, copyFile, copyFileSync, remove, removeSync, rename, renameSync, createReadStream, createWriteStream, pathExists, pathExistsSync, existsSync, lstat, readJson, writeJson } from 'fs-extra'; | ||
import { readdir, readdirSync, ensureDir, ensureDirSync, writeFileSync, readFile, readFileSync, move, moveSync, copy, copySync, copyFile, copyFileSync, remove, removeSync, rename, renameSync, createReadStream, createWriteStream, pathExists, pathExistsSync, existsSync, lstat, readJson, readJsonSync, writeJson, writeJsonSync, appendFile, appendFileSync } from 'fs-extra'; | ||
export declare const fs: { | ||
@@ -18,3 +18,3 @@ readdir: typeof readdir; | ||
ensureDirSync: typeof ensureDirSync; | ||
writeFile: typeof writeFile; | ||
writeFile: (path: string, data: any, options?: string | t.IFsWriteFileOptions | undefined) => Promise<void>; | ||
writeFileSync: typeof writeFileSync; | ||
@@ -40,3 +40,7 @@ readFile: typeof readFile; | ||
readJson: typeof readJson; | ||
readJsonSync: typeof readJsonSync; | ||
writeJson: typeof writeJson; | ||
writeJsonSync: typeof writeJsonSync; | ||
appendFile: typeof appendFile; | ||
appendFileSync: typeof appendFileSync; | ||
lstat: typeof lstat; | ||
@@ -60,3 +64,9 @@ lstatSync: import("fs").StatSyncFn<import("fs").PathLike>; | ||
}; | ||
stream: typeof stream; | ||
stream: { | ||
isReadableStream(input: any): boolean; | ||
encode(input?: string | undefined): Uint8Array; | ||
decode(input?: BufferSource | undefined, options?: TextDecodeOptions | undefined): string; | ||
toUint8Array(input: t.Json | Uint8Array | ReadableStream<any>): Promise<Uint8Array>; | ||
save(path: string, data: t.Json | ReadableStream<any>): Promise<void>; | ||
}; | ||
glob: { | ||
@@ -63,0 +73,0 @@ find(pattern: string, input?: import("./glob/Glob").GlobFindFilter | import("./glob/Glob").GlobFindOptions | undefined): Promise<string[]>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fs = void 0; | ||
var tslib_1 = require("tslib"); | ||
var path = require("path"); | ||
@@ -19,2 +20,21 @@ var file_1 = require("./file"); | ||
var exists = function (path) { return fs_extra_1.pathExists(path); }; | ||
var writeFile = function (path, data) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4, fs_extra_1.ensureDir(dirname(path))]; | ||
case 1: | ||
_a.sent(); | ||
if (!is_1.is.stream(data)) return [3, 3]; | ||
return [4, stream_1.stream.save(path, data)]; | ||
case 2: | ||
_a.sent(); | ||
return [3, 5]; | ||
case 3: return [4, fs_extra_1.writeFile(path, data)]; | ||
case 4: | ||
_a.sent(); | ||
_a.label = 5; | ||
case 5: return [2]; | ||
} | ||
}); | ||
}); }; | ||
exports.fs = { | ||
@@ -25,3 +45,3 @@ readdir: fs_extra_1.readdir, | ||
ensureDirSync: fs_extra_1.ensureDirSync, | ||
writeFile: fs_extra_1.writeFile, | ||
writeFile: writeFile, | ||
writeFileSync: fs_extra_1.writeFileSync, | ||
@@ -47,3 +67,7 @@ readFile: fs_extra_1.readFile, | ||
readJson: fs_extra_1.readJson, | ||
readJsonSync: fs_extra_1.readJsonSync, | ||
writeJson: fs_extra_1.writeJson, | ||
writeJsonSync: fs_extra_1.writeJsonSync, | ||
appendFile: fs_extra_1.appendFile, | ||
appendFileSync: fs_extra_1.appendFileSync, | ||
lstat: fs_extra_1.lstat, | ||
@@ -50,0 +74,0 @@ lstatSync: fs_extra_1.lstatSync, |
import { fs } from './fs'; | ||
export { fs }; | ||
export { Stream } from './stream'; | ||
export default fs; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fs = void 0; | ||
exports.Stream = exports.fs = void 0; | ||
var fs_1 = require("./fs"); | ||
Object.defineProperty(exports, "fs", { enumerable: true, get: function () { return fs_1.fs; } }); | ||
var stream_1 = require("./stream"); | ||
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return stream_1.Stream; } }); | ||
exports.default = fs_1.fs; |
@@ -1,2 +0,9 @@ | ||
import * as stream from './stream'; | ||
export { stream }; | ||
import { Stream } from './Stream'; | ||
export { Stream }; | ||
export declare const stream: { | ||
isReadableStream(input: any): boolean; | ||
encode(input?: string | undefined): Uint8Array; | ||
decode(input?: BufferSource | undefined, options?: TextDecodeOptions | undefined): string; | ||
toUint8Array(input: import("@platform/types").Json | Uint8Array | ReadableStream<any>): Promise<Uint8Array>; | ||
save(path: string, data: import("@platform/types").Json | ReadableStream<any>): Promise<void>; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stream = void 0; | ||
var stream = require("./stream"); | ||
exports.stream = stream; | ||
exports.stream = exports.Stream = void 0; | ||
var Stream_1 = require("./Stream"); | ||
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return Stream_1.Stream; } }); | ||
exports.stream = Stream_1.Stream; |
{ | ||
"name": "@platform/fs", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"description": "POSIX style file-system tools.", | ||
@@ -14,4 +14,4 @@ "main": "lib/index", | ||
"dependencies": { | ||
"@platform/fs.types": "0.1.10", | ||
"@platform/types": "0.5.23", | ||
"@platform/fs.types": "0.1.11", | ||
"@platform/types": "0.5.24", | ||
"@types/fs-extra": "9.0.12", | ||
@@ -29,4 +29,4 @@ "@types/js-yaml": "4.0.2", | ||
"devDependencies": { | ||
"@platform/test": "0.2.8", | ||
"@platform/ts.libs": "4.3.1", | ||
"@platform/test": "0.2.9", | ||
"@platform/ts.libs": "4.3.2", | ||
"@types/archiver": "5.1.1", | ||
@@ -33,0 +33,0 @@ "@types/dotenv": "8.2.0", |
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
63539
74
1541
+ Added@platform/fs.types@0.1.11(transitive)
+ Added@platform/types@0.5.24(transitive)
- Removed@platform/fs.types@0.1.10(transitive)
- Removed@platform/types@0.5.23(transitive)
Updated@platform/fs.types@0.1.11
Updated@platform/types@0.5.24