atomically
Advanced tools
Comparing version 2.0.0 to 2.0.1
/* IMPORT */ | ||
import os from 'node:os'; | ||
import process from 'node:process'; | ||
/* MAIN */ | ||
@@ -15,6 +16,6 @@ const DEFAULT_ENCODING = 'utf8'; | ||
const IS_USER_ROOT = process.getuid ? !process.getuid() : false; | ||
const LIMIT_BASENAME_LENGTH = 128; //TODO: fetch the real limit from the filesystem //TODO: fetch the whole-path length limit too | ||
const LIMIT_FILES_DESCRIPTORS = 10000; //TODO: fetch the real limit from the filesystem | ||
const LIMIT_BASENAME_LENGTH = 128; //TODO: Fetch the real limit from the filesystem //TODO: Fetch the whole-path length limit too | ||
const LIMIT_FILES_DESCRIPTORS = 10000; //TODO: Fetch the real limit from the filesystem | ||
const NOOP = () => { }; | ||
/* EXPORT */ | ||
export { DEFAULT_ENCODING, DEFAULT_FILE_MODE, DEFAULT_FOLDER_MODE, DEFAULT_READ_OPTIONS, DEFAULT_WRITE_OPTIONS, DEFAULT_USER_UID, DEFAULT_USER_GID, DEFAULT_TIMEOUT_ASYNC, DEFAULT_TIMEOUT_SYNC, IS_POSIX, IS_USER_ROOT, LIMIT_BASENAME_LENGTH, LIMIT_FILES_DESCRIPTORS, NOOP }; |
@@ -13,3 +13,3 @@ /// <reference types="node" /> | ||
declare function writeFile(filePath: Path, data: Data, options?: Encoding | WriteOptions, callback?: Callback): Promise<void>; | ||
declare const writeFileSync: (filePath: Path, data: Data, options?: Encoding | WriteOptions) => void; | ||
declare function writeFileSync(filePath: Path, data: Data, options?: Encoding | WriteOptions): void; | ||
export { readFile, readFileSync, writeFile, writeFileSync }; |
@@ -116,3 +116,3 @@ /* IMPORT */ | ||
} | ||
const writeFileSync = (filePath, data, options = DEFAULT_WRITE_OPTIONS) => { | ||
function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) { | ||
if (isString(options)) | ||
@@ -195,4 +195,4 @@ return writeFileSync(filePath, data, { encoding: options }); | ||
} | ||
}; | ||
} | ||
/* EXPORT */ | ||
export { readFile, readFileSync, writeFile, writeFileSync }; |
/// <reference types="node" /> | ||
declare type Callback = (error: Exception | void) => void; | ||
declare type Data = Uint8Array | string | undefined; | ||
declare type Disposer = () => void; | ||
declare type Encoding = 'ascii' | 'base64' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2'; | ||
declare type Exception = NodeJS.ErrnoException; | ||
declare type Path = string; | ||
declare type ReadOptions = { | ||
type Callback = (error: Exception | void) => void; | ||
type Data = Uint8Array | string | undefined; | ||
type Disposer = () => void; | ||
type Encoding = 'ascii' | 'base64' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2'; | ||
type Exception = NodeJS.ErrnoException; | ||
type Path = string; | ||
type ReadOptions = { | ||
encoding?: Encoding | null; | ||
@@ -13,3 +13,3 @@ mode?: string | number | false; | ||
}; | ||
declare type WriteOptions = { | ||
type WriteOptions = { | ||
chown?: { | ||
@@ -16,0 +16,0 @@ gid: number; |
@@ -5,3 +5,3 @@ { | ||
"description": "Read and write files atomically and reliably.", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"type": "module", | ||
@@ -30,14 +30,14 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"stubborn-fs": "^1.2.1", | ||
"stubborn-fs": "^1.2.4", | ||
"when-exit": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.11.9", | ||
"esbuild": "^0.15.13", | ||
"@types/node": "^18.13.0", | ||
"esbuild": "^0.17.7", | ||
"require-inject": "^1.4.4", | ||
"tap": "^16.3.0", | ||
"tsex": "^1.1.2", | ||
"typescript": "^4.8.4", | ||
"tap": "^16.3.4", | ||
"tsex": "^2.1.0", | ||
"typescript": "^4.9.5", | ||
"write-file-atomic": "^5.0.0" | ||
} | ||
} |
@@ -5,2 +5,3 @@ | ||
import os from 'node:os'; | ||
import process from 'node:process'; | ||
@@ -31,5 +32,5 @@ /* MAIN */ | ||
const LIMIT_BASENAME_LENGTH = 128; //TODO: fetch the real limit from the filesystem //TODO: fetch the whole-path length limit too | ||
const LIMIT_BASENAME_LENGTH = 128; //TODO: Fetch the real limit from the filesystem //TODO: Fetch the whole-path length limit too | ||
const LIMIT_FILES_DESCRIPTORS = 10000; //TODO: fetch the real limit from the filesystem | ||
const LIMIT_FILES_DESCRIPTORS = 10_000; //TODO: Fetch the real limit from the filesystem | ||
@@ -36,0 +37,0 @@ const NOOP = () => {}; |
@@ -195,3 +195,3 @@ | ||
const writeFileSync = ( filePath: Path, data: Data, options: Encoding | WriteOptions = DEFAULT_WRITE_OPTIONS ): void => { | ||
function writeFileSync ( filePath: Path, data: Data, options: Encoding | WriteOptions = DEFAULT_WRITE_OPTIONS ): void { | ||
@@ -198,0 +198,0 @@ if ( isString ( options ) ) return writeFileSync ( filePath, data, { encoding: options } ); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
76192
1678
0
Updatedstubborn-fs@^1.2.4