From 4016d7fafc7edc2dea06bdb57c1b99b470dda8f0 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Wed, 6 Apr 2022 21:44:32 +0800 Subject: [PATCH] feat: Support `typescript`. --- index.d.ts | 14 ++++++++++++++ package.json | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..19fad97 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,14 @@ +/// + +import { Stats } from 'fs'; +import { Mode } from 'stat-mode'; + +export const readLink: (currentPath: string) => Promise; +export const readdir: (dir: string) => Promise; +/** 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; +/** Get all the file names in the directory. */ +export const readdirAsync: (directory: string) => Promise; +export const uidToName: (id?: string) => Promise[]>; +export const chmod: (file: string, mode: number | Mode) => Promise; + diff --git a/package.json b/package.json index ef7316e..40405d4 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -12,7 +13,8 @@ "fs" ], "files": [ - "index.js" + "index.js", + "index.d.ts" ], "repository": { "type": "git",