Skip to content

Commit

Permalink
Generate filesize types using flow
Browse files Browse the repository at this point in the history
```
flowgen ./node_modules/filesize/filesize.d.ts -o 
./flow-libs/filesize.js.flow --add-flow-header --no-module-exports
```
  • Loading branch information
aminya committed Jan 10, 2021
1 parent eefe7e3 commit d1b157e
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions flow-libs/filesize.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/**
* Flowtype definitions for filesize
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.13.0
* @flow
*/

declare var fileSize: Filesize$Filesize;
declare export default typeof fileSize;
declare var Filesize: typeof npm$namespace$Filesize;

declare var npm$namespace$Filesize: {|
SiJedecBits: Class<Filesize$SiJedecBits>,
SiJedecBytes: Class<Filesize$SiJedecBytes>,
Options: Class<Filesize$Options>,
Filesize: Class<Filesize$Filesize>,
|};
declare interface Filesize$SiJedecBits {
b?: string;
Kb?: string;
Mb?: string;
Gb?: string;
Tb?: string;
Pb?: string;
Eb?: string;
Zb?: string;
Yb?: string;
}

declare interface Filesize$SiJedecBytes {
B?: string;
KB?: string;
MB?: string;
GB?: string;
TB?: string;
PB?: string;
EB?: string;
ZB?: string;
YB?: string;
}

declare type Filesize$SiJedec = Filesize$SiJedecBits &
Filesize$SiJedecBytes & {
[name: string]: string,
...
};

declare interface Filesize$Options {
/**
* Number base, default is 2
*/
base?: number;

/**
* Enables bit sizes, default is false
*/
bits?: boolean;

/**
* Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1
*/
exponent?: number;

/**
* Enables full form of unit of measure, default is false
*/
fullform?: boolean;

/**
* Array of full form overrides, default is []
*/
fullforms?: string[];

/**
* BCP 47 language tag to specify a locale, or true to use default locale, default is ""
*/
locale?: string | boolean;

/**
* ECMA-402 number format option overrides, default is "{}"
*/
localeOptions?: Intl.NumberFormatOptions;

/**
* Output of function (array, exponent, object, or string), default is string
*/
output?: "array" | "exponent" | "object" | "string";

/**
* Decimal place, default is 2
*/
round?: number;

/**
* Decimal separator character, default is `.`
*/
separator?: string;

/**
* Character between the result and suffix, default is ` `
*/
spacer?: string;

/**
* Standard unit of measure, can be iec or jedec, default is jedec; can be overruled by base
*/
standard?: "iec" | "jedec";

/**
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
*/
symbols?: Filesize$SiJedec;

/**
* Enables unix style human readable output, e.g ls -lh, default is false
*/
unix?: boolean;
}

declare interface Filesize$Filesize {
(bytes: number, options?: Filesize$Options): string;
partial: (options: Filesize$Options) => (bytes: number) => string;
}

0 comments on commit d1b157e

Please sign in to comment.