@types/file-saver
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.3 • Public • Published

    Installation

    npm install --save @types/file-saver

    Summary

    This package contains type definitions for FileSaver.js (https://github.com/eligrey/FileSaver.js/).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/file-saver.

    index.d.ts

    // Type definitions for FileSaver.js 2.0
    // Project: https://github.com/eligrey/FileSaver.js/
    // Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
    //                 Daniel Roth <https://github.com/DaIgeb>
    //                 Chris Barr <https://github.com/chrismbarr>
    //                 HitkoDev <https://github.com/HitkoDev>
    //                 JounQin <https://github.com/JounQin>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    declare namespace FileSaver {
        interface FileSaverOptions {
            /**
             * Automatically provide Unicode text encoding hints
             * @default false
             */
            autoBom: boolean;
        }
    
        /**
         * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
         * @param data - The actual file data blob or URL.
         * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used.
         * @param options - Optional FileSaver.js config
         */
        function saveAs(data: Blob | string, filename?: string, options?: FileSaverOptions): void;
    
        /**
         * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
         * @param data - The actual file data blob or URL.
         * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used.
         * @param disableAutoBOM - Optional & defaults to `true`. Set to `false` if you want FileSaver.js to automatically provide Unicode text encoding hints
         * @deprecated use `{ autoBom: false }` as the third argument
         */
        // tslint:disable-next-line:unified-signatures
        function saveAs(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void;
    }
    
    declare global {
        const saveAs: typeof FileSaver.saveAs;
    
        interface Window {
            saveAs: typeof FileSaver.saveAs;
        }
    }
    
    export = FileSaver;

    Additional Details

    • Last updated: Fri, 09 Jul 2021 02:32:27 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by Cyril Schumacher, Daniel Roth, Chris Barr, HitkoDev, and JounQin.

    Keywords

    none

    Install

    npm i @types/file-saver

    DownloadsWeekly Downloads

    518,423

    Version

    2.0.3

    License

    MIT

    Unpacked Size

    7.47 kB

    Total Files

    4

    Last publish

    Collaborators

    • types