Skip to content

Commit

Permalink
feat: Support typescript.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 6, 2022
1 parent f6b6135 commit 4016d7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/// <reference types="node" />

import { Stats } from 'fs';
import { Mode } from 'stat-mode';

export const readLink: (currentPath: string) => Promise<string | Buffer>;
export const readdir: (dir: string) => Promise<Stats[]>;
/** Read a single directory or file the [stat](http://nodejs.cn/api/fs.html#fs_class_fs_stats) info. */
export const getStat: (dirOrFile: string) => Promise<Stats>;
/** Get all the file names in the directory. */
export const readdirAsync: (directory: string) => Promise<string[]>;
export const uidToName: (id?: string) => Promise<string | Record<string, string>[]>;
export const chmod: (file: string, mode: number | Mode) => Promise<null>;

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "2.1.4",
"description": "Reads the directory files and adds the stat info.",
"main": "index.js",
"typings": "index.d.ts",
"scripts": {
"test": "node test/index.js"
},
Expand All @@ -12,7 +13,8 @@
"fs"
],
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"repository": {
"type": "git",
Expand Down

0 comments on commit 4016d7f

Please sign in to comment.