fp-ts-node
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -99,1 +99,16 @@ /// <reference types="node" /> | ||
export declare function mkdir(options?: fs.Mode | fs.MakeDirectoryOptions): PathTaskEither<fs.PathLike, O.Option<string>>; | ||
/** | ||
* Asynchronously reads the entire contents of a file. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* If a file descriptor is provided, the underlying file will _not_ be closed automatically. | ||
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. | ||
* If a flag is not provided, it defaults to `'r'`. | ||
* | ||
* @category Constructors | ||
* @since 2.3.0 | ||
*/ | ||
export declare function readFile(options?: { | ||
flag?: string; | ||
encoding: BufferEncoding; | ||
}): PathTaskEither<fs.PathLike | number, string>; |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mkdir = exports.copyFile = exports.close = exports.chown = exports.chmod = exports.appendFile = exports.access = void 0; | ||
exports.readFile = exports.mkdir = exports.copyFile = exports.close = exports.chown = exports.chmod = exports.appendFile = exports.access = void 0; | ||
/** | ||
@@ -143,1 +143,18 @@ * @since 2.0.0 | ||
exports.mkdir = mkdir; | ||
/** | ||
* Asynchronously reads the entire contents of a file. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* If a file descriptor is provided, the underlying file will _not_ be closed automatically. | ||
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. | ||
* If a flag is not provided, it defaults to `'r'`. | ||
* | ||
* @category Constructors | ||
* @since 2.3.0 | ||
*/ | ||
function readFile(options) { | ||
return function (path) { | ||
return fp_ts_1.taskEither.taskify(fs.readFile)(path, options || { encoding: "utf8" }); | ||
}; | ||
} | ||
exports.readFile = readFile; |
/// <reference types="node" /> | ||
import * as FS from "fs"; | ||
import * as fs from "fs"; | ||
export { PathLike } from "fs"; | ||
export declare type Time = string | number | Date; | ||
/** | ||
* @summary | ||
* Time values that `_fs` accepts. | ||
* @see https://en.wikipedia.org/wiki/File_descriptor | ||
*/ | ||
export declare type Time = string | number | Date; | ||
export declare type FileDescriptor = number; | ||
/** | ||
* @summary | ||
* @typedef URL Must have a protocol of `"file:"`. | ||
* @typedef Buffer Potentially a side effect. | ||
*/ | ||
export declare type PathLike = FS.PathLike; | ||
export declare type PathLikeOrFD = FileDescriptor | FS.PathLike; | ||
export declare type PathLikeOrFD = FileDescriptor | fs.PathLike; | ||
export declare type WriteableData = string | NodeJS.ArrayBufferView; | ||
/** | ||
* @summary | ||
* Internally, these options are the stricter counterparts for `_fs.WriteFileOptions`, | ||
*/ | ||
export declare type WriteFileOptions = { | ||
flags?: Flags; | ||
mode?: FileMode; | ||
}; | ||
export interface MakeDirectoryOptions { | ||
recursive?: boolean; | ||
mode?: FileMode; | ||
} | ||
/** | ||
* @summary | ||
* A union of all possible file attributes. | ||
@@ -32,0 +14,0 @@ * |
@@ -99,1 +99,16 @@ /// <reference types="node" /> | ||
export declare function mkdir(options?: fs.Mode | fs.MakeDirectoryOptions): PathTaskEither<fs.PathLike, O.Option<string>>; | ||
/** | ||
* Asynchronously reads the entire contents of a file. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* If a file descriptor is provided, the underlying file will _not_ be closed automatically. | ||
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. | ||
* If a flag is not provided, it defaults to `'r'`. | ||
* | ||
* @category Constructors | ||
* @since 2.3.0 | ||
*/ | ||
export declare function readFile(options?: { | ||
flag?: string; | ||
encoding: BufferEncoding; | ||
}): PathTaskEither<fs.PathLike | number, string>; |
@@ -99,1 +99,15 @@ /** | ||
} | ||
/** | ||
* Asynchronously reads the entire contents of a file. | ||
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol. | ||
* URL support is _experimental_. | ||
* If a file descriptor is provided, the underlying file will _not_ be closed automatically. | ||
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. | ||
* If a flag is not provided, it defaults to `'r'`. | ||
* | ||
* @category Constructors | ||
* @since 2.3.0 | ||
*/ | ||
export function readFile(options) { | ||
return (path) => TE.taskify(fs.readFile)(path, options || { encoding: "utf8" }); | ||
} |
/// <reference types="node" /> | ||
import * as FS from "fs"; | ||
import * as fs from "fs"; | ||
export { PathLike } from "fs"; | ||
export declare type Time = string | number | Date; | ||
/** | ||
* @summary | ||
* Time values that `_fs` accepts. | ||
* @see https://en.wikipedia.org/wiki/File_descriptor | ||
*/ | ||
export declare type Time = string | number | Date; | ||
export declare type FileDescriptor = number; | ||
/** | ||
* @summary | ||
* @typedef URL Must have a protocol of `"file:"`. | ||
* @typedef Buffer Potentially a side effect. | ||
*/ | ||
export declare type PathLike = FS.PathLike; | ||
export declare type PathLikeOrFD = FileDescriptor | FS.PathLike; | ||
export declare type PathLikeOrFD = FileDescriptor | fs.PathLike; | ||
export declare type WriteableData = string | NodeJS.ArrayBufferView; | ||
/** | ||
* @summary | ||
* Internally, these options are the stricter counterparts for `_fs.WriteFileOptions`, | ||
*/ | ||
export declare type WriteFileOptions = { | ||
flags?: Flags; | ||
mode?: FileMode; | ||
}; | ||
export interface MakeDirectoryOptions { | ||
recursive?: boolean; | ||
mode?: FileMode; | ||
} | ||
/** | ||
* @summary | ||
* A union of all possible file attributes. | ||
@@ -32,0 +14,0 @@ * |
{ | ||
"name": "fp-ts-node", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"files": [ | ||
@@ -50,2 +50,5 @@ "dist" | ||
}, | ||
"engines": { | ||
"node": "14 || 16" | ||
}, | ||
"release": { | ||
@@ -64,2 +67,3 @@ "branches": [ | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
[ | ||
@@ -66,0 +70,0 @@ "@semantic-release/git", |
@@ -7,3 +7,3 @@ # fp-ts-node | ||
## Implied Defaults | ||
## File Systems (`fs`) | ||
@@ -20,1 +20,12 @@ For the `fs` module, every API requires a path. Most API's can take options and some take data too. | ||
``` | ||
## Upcoming | ||
If you're looking forward to any of these features, please advise in the discussions tab. | ||
This way we can justify our work with demand. | ||
- [ ] Add exports `import { path as fs, fd as fs, bf as fs} from "fp-ts-node/fs"`, so users can specify onto file descriptor, path or buffer value API's. | ||
- [ ] NodeJS Versioning: | ||
- Version to NodeJS based on latest version number `@types/node@^{14,16}`. | ||
- Export as `import { fs } from "fp-ts-node/14"`. | ||
- Export LTS (currently 14) to `import { fs } from "fp-ts-node` by default. |
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
37985
682
30