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

fp-ts-node

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fp-ts-node - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

dist/cjs/fs/_internal.d.ts

56

dist/cjs/fs.d.ts
/// <reference types="node" />
/**
* @since 2.0.0
*/
import { option as O, readerTaskEither as RTE } from "fp-ts";
import * as fs from "fs";
import { PathLikeOrFD, ReaderTaskNodeEither } from "./fs/types";
export {

@@ -12,31 +9,17 @@ /**

*/
copyFile, } from "./fs/path";
copyFile,
/**
* The path is the dependency here, because many operations being applied to a
* path is the most likely case.
*
* @category Model
* @since 2.0.0
* @category Constructors
* @since 2.2.0
*/
export declare type PathTaskEither<R extends fs.PathLike | number, A> = RTE.ReaderTaskEither<R, NodeJS.ErrnoException, A>;
mkdir,
/**
* Asynchronously tests a user's permissions for the file specified by path.
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
*
* @category Constructors
* @since 2.0.0
*/
export declare function access(mode?: number): PathTaskEither<fs.PathLike, void>;
appendFile, } from "./fs/path";
/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
* Asynchronously tests a user's permissions for the file specified by path.
* @param path A path to a file or directory. 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*

@@ -46,3 +29,3 @@ * @category Constructors

*/
export declare function appendFile(options?: fs.WriteFileOptions): (data: string | Uint8Array) => PathTaskEither<number | fs.PathLike, void>;
export declare function access(mode?: number): ReaderTaskNodeEither<fs.PathLike, void>;
/**

@@ -56,3 +39,3 @@ * Asynchronous chmod(2) - Change permissions of a file.

*/
export declare function chmod(mode: fs.Mode): PathTaskEither<fs.PathLike, void>;
export declare function chmod(mode: fs.Mode): ReaderTaskNodeEither<fs.PathLike, void>;
/**

@@ -65,3 +48,3 @@ * Asynchronous chown(2) - Change ownership of a file.

*/
export declare function chown(uid: number, gid: number): PathTaskEither<fs.PathLike, void>;
export declare function chown(uid: number, gid: number): ReaderTaskNodeEither<fs.PathLike, void>;
/**

@@ -74,17 +57,4 @@ * Asynchronous close(2) - close a file descriptor.

*/
export declare const close: PathTaskEither<number, void>;
export declare const close: ReaderTaskNodeEither<number, void>;
/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 2.2.0
*/
export declare function mkdir(options?: fs.Mode | fs.MakeDirectoryOptions): PathTaskEither<fs.PathLike, O.Option<string>>;
/**
* Asynchronously reads the entire contents of a file.

@@ -103,2 +73,2 @@ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

encoding: BufferEncoding;
}): PathTaskEither<fs.PathLike | number, string>;
}): ReaderTaskNodeEither<PathLikeOrFD, string>;

@@ -22,3 +22,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.readFile = exports.mkdir = exports.close = exports.chown = exports.chmod = exports.appendFile = exports.access = exports.copyFile = void 0;
exports.readFile = exports.close = exports.chown = exports.chmod = exports.access = exports.appendFile = exports.mkdir = exports.copyFile = void 0;
/**

@@ -28,3 +28,2 @@ * @since 2.0.0

var fp_ts_1 = require("fp-ts");
var function_1 = require("fp-ts/lib/function");
var fs = __importStar(require("fs"));

@@ -38,2 +37,12 @@ var path_1 = require("./fs/path");

/**
* @category Constructors
* @since 2.2.0
*/
Object.defineProperty(exports, "mkdir", { enumerable: true, get: function () { return path_1.mkdir; } });
/**
* @category Constructors
* @since 2.0.0
*/
Object.defineProperty(exports, "appendFile", { enumerable: true, get: function () { return path_1.appendFile; } });
/**
* Asynchronously tests a user's permissions for the file specified by path.

@@ -53,26 +62,2 @@ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.

/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*
* @category Constructors
* @since 2.0.0
*/
function appendFile(options) {
if (options === void 0) { options = {}; }
return function (data) {
return function (path) {
return fp_ts_1.taskEither.taskify(fs.appendFile)(path, data, options);
};
};
}
exports.appendFile = appendFile;
/**
* Asynchronous chmod(2) - Change permissions of a file.

@@ -113,20 +98,2 @@ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 2.2.0
*/
function mkdir(options) {
return function (path) {
return (0, function_1.pipe)(fp_ts_1.taskEither.taskify(fs.mkdir)(path, options), fp_ts_1.taskEither.map(fp_ts_1.option.fromNullable));
};
}
exports.mkdir = mkdir;
/**
* Asynchronously reads the entire contents of a file.

@@ -133,0 +100,0 @@ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

/// <reference types="node" />
import { option as O } from "fp-ts";
import * as fs from "fs";
import { ReaderTaskNodeEither } from "./types";
/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*
* @category Constructors
* @since 4.0.0
*/
export declare const appendFile: (options?: fs.WriteFileOptions) => (data: string | Uint8Array) => ReaderTaskNodeEither<fs.PathLike, void>;
/**
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

@@ -27,1 +44,14 @@ * No arguments other than a possible exception are given to the callback function.

}): ReaderTaskNodeEither<fs.PathLike, void>;
/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 3.2.0
*/
export declare function mkdir(options?: fs.Mode | fs.MakeDirectoryOptions): ReaderTaskNodeEither<fs.PathLike, O.Option<string>>;

@@ -22,6 +22,24 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.copyFile = void 0;
exports.mkdir = exports.copyFile = exports.appendFile = void 0;
var fp_ts_1 = require("fp-ts");
var function_1 = require("fp-ts/lib/function");
var fs = __importStar(require("fs"));
var fp_ts_1 = require("fp-ts");
var internal = __importStar(require("./_internal"));
/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*
* @category Constructors
* @since 4.0.0
*/
exports.appendFile = internal.appendFile;
/**
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

@@ -48,1 +66,19 @@ * No arguments other than a possible exception are given to the callback function.

exports.copyFile = copyFile;
/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 3.2.0
*/
function mkdir(options) {
return function (path) {
return (0, function_1.pipe)(fp_ts_1.taskEither.taskify(fs.mkdir)(path, options), fp_ts_1.taskEither.map(fp_ts_1.option.fromNullable));
};
}
exports.mkdir = mkdir;
/// <reference types="node" />
/**
* @since 2.0.0
*/
import { option as O, readerTaskEither as RTE } from "fp-ts";
import * as fs from "fs";
import { PathLikeOrFD, ReaderTaskNodeEither } from "./fs/types";
export {

@@ -12,31 +9,17 @@ /**

*/
copyFile, } from "./fs/path";
copyFile,
/**
* The path is the dependency here, because many operations being applied to a
* path is the most likely case.
*
* @category Model
* @since 2.0.0
* @category Constructors
* @since 2.2.0
*/
export declare type PathTaskEither<R extends fs.PathLike | number, A> = RTE.ReaderTaskEither<R, NodeJS.ErrnoException, A>;
mkdir,
/**
* Asynchronously tests a user's permissions for the file specified by path.
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
* URL support is _experimental_.
*
* @category Constructors
* @since 2.0.0
*/
export declare function access(mode?: number): PathTaskEither<fs.PathLike, void>;
appendFile, } from "./fs/path";
/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
* Asynchronously tests a user's permissions for the file specified by path.
* @param path A path to a file or directory. 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*

@@ -46,3 +29,3 @@ * @category Constructors

*/
export declare function appendFile(options?: fs.WriteFileOptions): (data: string | Uint8Array) => PathTaskEither<number | fs.PathLike, void>;
export declare function access(mode?: number): ReaderTaskNodeEither<fs.PathLike, void>;
/**

@@ -56,3 +39,3 @@ * Asynchronous chmod(2) - Change permissions of a file.

*/
export declare function chmod(mode: fs.Mode): PathTaskEither<fs.PathLike, void>;
export declare function chmod(mode: fs.Mode): ReaderTaskNodeEither<fs.PathLike, void>;
/**

@@ -65,3 +48,3 @@ * Asynchronous chown(2) - Change ownership of a file.

*/
export declare function chown(uid: number, gid: number): PathTaskEither<fs.PathLike, void>;
export declare function chown(uid: number, gid: number): ReaderTaskNodeEither<fs.PathLike, void>;
/**

@@ -74,17 +57,4 @@ * Asynchronous close(2) - close a file descriptor.

*/
export declare const close: PathTaskEither<number, void>;
export declare const close: ReaderTaskNodeEither<number, void>;
/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 2.2.0
*/
export declare function mkdir(options?: fs.Mode | fs.MakeDirectoryOptions): PathTaskEither<fs.PathLike, O.Option<string>>;
/**
* Asynchronously reads the entire contents of a file.

@@ -103,2 +73,2 @@ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

encoding: BufferEncoding;
}): PathTaskEither<fs.PathLike | number, string>;
}): ReaderTaskNodeEither<PathLikeOrFD, string>;
/**
* @since 2.0.0
*/
import { option as O, taskEither as TE } from "fp-ts";
import { pipe } from "fp-ts/lib/function";
import { taskEither as TE } from "fp-ts";
import * as fs from "fs";

@@ -12,4 +11,14 @@ export {

*/
copyFile, } from "./fs/path";
copyFile,
/**
* @category Constructors
* @since 2.2.0
*/
mkdir,
/**
* @category Constructors
* @since 2.0.0
*/
appendFile, } from "./fs/path";
/**
* Asynchronously tests a user's permissions for the file specified by path.

@@ -26,20 +35,2 @@ * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.

/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*
* @category Constructors
* @since 2.0.0
*/
export function appendFile(options = {}) {
return (data) => (path) => TE.taskify(fs.appendFile)(path, data, options);
}
/**
* Asynchronous chmod(2) - Change permissions of a file.

@@ -74,17 +65,2 @@ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 2.2.0
*/
export function mkdir(options) {
return (path) => pipe(TE.taskify(fs.mkdir)(path, options), TE.map(O.fromNullable));
}
/**
* Asynchronously reads the entire contents of a file.

@@ -91,0 +67,0 @@ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.

/// <reference types="node" />
import { option as O } from "fp-ts";
import * as fs from "fs";
import { ReaderTaskNodeEither } from "./types";
/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*
* @category Constructors
* @since 4.0.0
*/
export declare const appendFile: (options?: fs.WriteFileOptions) => (data: string | Uint8Array) => ReaderTaskNodeEither<fs.PathLike, void>;
/**
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

@@ -27,1 +44,14 @@ * No arguments other than a possible exception are given to the callback function.

}): ReaderTaskNodeEither<fs.PathLike, void>;
/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 3.2.0
*/
export declare function mkdir(options?: fs.Mode | fs.MakeDirectoryOptions): ReaderTaskNodeEither<fs.PathLike, O.Option<string>>;

@@ -0,4 +1,22 @@

import { option as O, taskEither as TE } from "fp-ts";
import { pipe } from "fp-ts/lib/function";
import * as fs from "fs";
import { taskEither as TE } from "fp-ts";
import * as internal from "./_internal";
/**
* Asynchronously append data to a file, creating the file if it does not exist.
* @param file 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 data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
* If `encoding` is not supplied, the default of `'utf8'` is used.
* If `mode` is not supplied, the default of `0o666` is used.
* If `mode` is a string, it is parsed as an octal integer.
* If `flag` is not supplied, the default of `'a'` is used.
*
* @category Constructors
* @since 4.0.0
*/
export const appendFile = internal.appendFile;
/**
* Asynchronously copies src to dest. By default, dest is overwritten if it already exists.

@@ -22,1 +40,16 @@ * No arguments other than a possible exception are given to the callback function.

}
/**
* Asynchronous mkdir(2) - create a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
*
* If `options.recursive == true`, the return value will be `Some<string>`,
* where the first created folder will be returned.
*
* @category Constructors
* @since 3.2.0
*/
export function mkdir(options) {
return (path) => pipe(TE.taskify(fs.mkdir)(path, options), TE.map(O.fromNullable));
}
{
"name": "fp-ts-node",
"version": "3.1.0",
"version": "4.0.0",
"files": [

@@ -5,0 +5,0 @@ "dist"

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