@types/write
TypeScript definitions for write
Last updated 6 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/write 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/write

Summary

This package contains type definitions for write (https://github.com/jonschlinkert/write).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/write.

index.d.ts

// Type definitions for write 2.0
// Project: https://github.com/jonschlinkert/write
// Definitions by: Junxiao Shi <https://github.com/yoursunny>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.5

/// <reference types="node" />
import * as fs from "fs";

type Data = string|Buffer|Uint8Array;

interface CommonOptions {
    newline?: boolean | undefined;
    overwrite?: boolean | undefined;
    increment?: boolean | undefined;
}

type Options = Omit<fs.WriteFileOptions, "encoding"> &
               Omit<fs.MakeDirectoryOptions, "recursive"> &
               CommonOptions;

type CreateWriteStreamOptions = Extract<Parameters<typeof fs.createWriteStream>[1], Record<string, any>>;

type StreamOptions = Omit<CreateWriteStreamOptions, "encoding"> &
                     Omit<fs.MakeDirectoryOptions, "recursive"> &
                     CommonOptions;

interface Result<T extends Data> {
    path: string;
    data: T;
}

type Callback<T extends Data> = (err: Error|null, result?: Result<T>) => any;

declare function write<T extends Data>(filepath: string, data: T, options: Options, callback: Callback<T>): void;
declare function write<T extends Data>(filepath: string, data: T, callback: Callback<T>): void;
declare function write<T extends Data>(filepath: string, data: T, options?: Options): Promise<Result<T>>;

declare namespace write {
    function sync<T extends Data>(filepath: string, data: T, options?: Options): Result<T>;

    function stream(filepath: string, options?: StreamOptions): fs.WriteStream;
}

export = write;

Additional Details

  • Last updated: Fri, 02 Jul 2021 18:06:03 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Junxiao Shi.

Current Tags

  • 2.0.1                                ...           latest (5 years ago)
  • 2.0.0                                ...           ts3.5 (6 years ago)
  • 2.0.1                                ...           ts3.6 (5 years ago)
  • 2.0.1                                ...           ts3.7 (5 years ago)
  • 2.0.1                                ...           ts3.8 (5 years ago)
  • 2.0.1                                ...           ts3.9 (5 years ago)
  • 2.0.1                                ...           ts4.0 (5 years ago)
  • 2.0.1                                ...           ts4.1 (5 years ago)
  • 2.0.1                                ...           ts4.2 (5 years ago)
  • 2.0.1                                ...           ts4.3 (5 years ago)
  • 2.0.1                                ...           ts4.4 (5 years ago)
  • 2.0.1                                ...           ts4.5 (5 years ago)
  • 2.0.1                                ...           ts4.6 (5 years ago)
  • 2.0.1                                ...           ts4.7 (5 years ago)
  • 2.0.1                                ...           ts4.8 (5 years ago)
  • 2.0.1                                ...           ts4.9 (5 years ago)
  • 2.0.1                                ...           ts5.0 (5 years ago)
  • 2.0.1                                ...           ts5.1 (5 years ago)

2 Versions

  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (1)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |