4.1.3 • Published 11 days ago

hexo-fs v4.1.3

Weekly downloads
27,187
License
MIT
Repository
github
Last release
11 days 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-ehc@yanmingsohu/require-lib@stormking/hexo-deployer-ipfs@wangjiezhe/hexo-helper-live2dfis3-command-deploy@hexo-testing-monorepo/hexo@breautek/hexo-prism-pluginfeflow-cligoldthree-hexo-prism-plugin@jiangtj/hexo-patch-load-theme-config@metaio/hexo-filter-meta-spacehexo-generator-readtimehexo-githubhexo-github-cardhexo-github-card-customizehexo-instagram-wallhexo-jsharkc-live2dhexo-insta-wallhexo-hookhexo-lazysizeshexo-leetcode-calendarhexo-iconifyhexo-image-lazyloaderhexo-synchexo-tag-accordionlisthexo-tag-aplayerhexo-tag-aplayer2hexo-tag-flickrhexo-tag-flickr-extendedhexo-tag-google-photos-album-galleryhexo-steamhexo-steam-gameshexo-steamgames-pagehexo-stripepay-deployer-herokuhexo-tag-mmediahexo-tag-music-playerhexo-tag-ossimghexo-tag-dplayerhexo-tag-graphvizhexo-tag-leaflet-nightmarehexo-tag-demohexo-tag-bilibili-bangumihexo-tag-cloudhexo-tag-local-video-jshexo-talkhexo-tag-publicationshexo-tag-randpaginghexo-tag-videojshexo-gpt-taghexo-hades-live2dhexo-helper-quizhexo-helper-live2dhexo-generator-tagsnethexo-processor-statichexo-readerhexo-recommended-postshexo-related-popular-postshexo-pocket-pluginhexo-posts-synchexo-prism-pluginhexo-prism-plugin-advancedhexo-prism-plugin-chlandscapehexo-prismjs-pluginhexo-prohexo-plug-adminhexo-plugin-socialshexo-photoswipehexo-plhexo-pandoc-tippyhexo-unique-post-pathhexo-url-imagehexo-tippyhexo-tmdb-listhexo-to-ipfshexo-theme-shokaxhexo-uuidlinkhexo-vtuber-bannerhexo-web-push-notificationhexo-webpushrhexo-workboxhexo-zeronet-commentshexoxhexo-multiauthorhexo-multiauthorshexo-my-admin-headerimghexo-myoss-tencent-coshexo-live2d-remhexo-live3dhexo-maintance
4.1.3

11 days ago

4.1.2

11 days ago

4.1.0

1 year ago

4.1.1

1 year ago

4.0.0

2 years ago

3.1.0

4 years ago

2.0.1

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago

0.2.3

6 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago