4.1.3 • Published 8 months ago

hexo-fs v4.1.3

Weekly downloads
27,187
License
MIT
Repository
github
Last release
8 months ago

hexo-fs

CI NPM version Coverage Status

File system module for Hexo.

Features

  • Support for both Promise and callback interface.
  • Use graceful-fs to avoid EMFILE error and various improvements.
  • Use chokidar for consistent file watching.

Installation

$ npm install hexo-fs --save

Usage

const fs = require('hexo-fs');

Some methods in the original fs module are not listed below, but they're available in hexo-fs.

exists(path)

Test whether or not the given path exists by checking with the file system.

existsSync(path)

Synchronous version of fs.exists.

mkdirs(path)

Creates a directory and its parent directories if they does not exist.

mkdirsSync(path)

Synchronous version of fs.mkdirs.

writeFile(path, data, options)

Writes data to a file.

OptionDescriptionDefault
encodingFile encodingutf8
modeMode438 (0666 in octal)
flagFlagw

writeFileSync(path, data, options)

Synchronous version of fs.writeFile.

appendFile(path, data, options)

Appends data to a file.

OptionDescriptionDefault
encodingFile encodingutf8
modeMode438 (0666 in octal)
flagFlagw

appendFileSync(path, data, options)

Synchronous version of fs.appendFile.

copyFile(src, dest, callback)

Copies a file from src to dest.

copyDir(src, dest, options)

Copies a directory from src to dest. It returns an array of copied files.

OptionDescriptionDefault
ignoreHiddenIgnore hidden filestrue
ignorePatternIgnore files which pass the regular expression

listDir(path, options)

Lists files in a directory.

OptionDescriptionDefault
ignoreHiddenIgnore hidden filestrue
ignorePatternIgnore files which pass the regular expression

listDirSync(path, options)

Synchronous version of fs.listDir.

readFile(path, options)

Reads the entire contents of a file.

OptionDescriptionDefault
encodingFile encodingutf8
flagFlagr
escapeEscape UTF BOM and line ending in the contenttrue

readFileSync(path, options)

Synchronous version of fs.readFile.

emptyDir(path, options)

Deletes all files in a directory. It returns an array of deleted files.

OptionDescriptionDefault
ignoreHiddenIgnore hidden filestrue
ignorePatternIgnore files which pass the regular expression
excludeIgnore files in the array

emptyDirSync(path, options)

Synchronous version of fs.emptyDir.

rmdir(path)

Removes a directory and all files in it.

rmdirSync(path)

Synchronous version of fs.rmdir.

watch(path, options)

Watches changes of a file or a directory.

See Chokidar API for more info.

ensurePath(path)

Ensures the given path is available to use or appends a number to the path.

ensurePathSync(path)

Synchronous version of fs.ensurePath.

ensureWriteStream(path, options)

Creates the parent directories if they does not exist and returns a writable stream.

ensureWriteStreamSync(path, options)

Synchronous version of fs.ensureWriteStream.

License

MIT

hfsyun-bilimihexo-deployer-cos-cdn-wwwhexo-abbrlink-podcastshexo-generate-jsonhexo-prism-plugin-fixedhexo-musix-adminhexo-admin-musix@infinitebrahmanuniverse/nolb-hexo-fhexo-cachecoding-static-website@everything-registry/sub-chunk-1843hexo-bridge-ehchexo-bilibili-bangumi-hfsyunhexo-douban-up2hexo-booksmkdocs-render-math-ssrmockstar-clihexo-bridgehexo-bridge-pluginhexo-bgmtv-bangumihexo-bilibili-bangumihexo-bilibili-bangumi-anzhiyuhexo-bilibili-bangumi-plushexo-blog-encrypt-customizedhexo-blog-encrypt-modifiedhexo-blog-encrypt-with-insidehexo-blog-encrypt-with-sweetalerthexo-butterfly-statictalkhexo-auto-front-matterhexo-auto-taghexo-butterfly-doubanhexo-butterfly-douban-zkeqhexo-bangumi-butterflyhexo-bangumi-galleryhexo-bangumishexo-basedir-deployer-githexo-better-steamhexo-cake-live2dhexo-auto-categoryhexo-auto-fronthexo-compat-reporthexo-console-renamehexo-clihexo-code-pluginhexo-cos-uploaderhexo-deployer-cos-cdnhexo-deployer-cos-enhancedhexo-deployer-cos-enhanced-envhexo-deployer-cos-enhanced2hexo-deployer-cos-inksshexo-deployer-firebasehexo-deployer-getforgehexo-deployer-githexo-deployer-git-fxhexo-deployer-git-kshhexo-deployer-git-plushexo-deployer-git-sourcehexo-deployer-herokuhexo-deployer-heroku-fcpauldiazhexo-deployer-hostmanhexo-cover-colorhexo-cover-utilshexo-critical-csshexo-custom-layouthexo-cdn-jsdelivrhexo-cdn-refresherhexo-deployer-aliyunhexo-deployer-aliyun-incrhexo-deployer-appenginehexo-deployer-cloudbasehexo-deployer-coshexo-deployer-ipfshexo-deployer-ipfs-plushexo-deployer-kodohexo-deployer-lightcoshexo-deployer-metawebloghexo-deployer-netlifyhexo-deployer-onesignalhexo-deployer-openshifthexo-deployer-pinatahexo-encrypthexo-encrypt-posthexo-enhancerhexo-enhancer-for-diaryhexo-evernote-htmlhexo-ext-imghexo-featured-imagehexo-dplayer-customizedhexo-easy-imageshexo-editorhexo-deployer-qiniu-fixedhexo-deployer-qiniucloudhexo-deployer-qiniucloud2hexo-deployer-qoshexo-deployer-rss3hexo-deployer-tcbhexo-douban-mellowhexo-douban-modifiedhexo-douban-modifyhexo-douban-music
4.1.3

8 months ago

4.1.2

8 months ago

4.1.0

2 years ago

4.1.1

2 years ago

4.0.0

2 years ago

3.1.0

5 years ago

2.0.1

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

8 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago