shinnn / Fs Readfile Promise
Licence: isc
Promisified version of fs.readFile
Stars: ✭ 48
Programming Languages
javascript
184084 projects - #8 most used programming language
Labels
Projects that are alternatives of or similar to Fs Readfile Promise
C Sharp Promise
Promises library for C# for management of asynchronous operations.
Stars: ✭ 870 (+1712.5%)
Mutual labels: promise
Franticapparatus
Type and memory safe promises for Swift, supports cancellation
Stars: ✭ 27 (-43.75%)
Mutual labels: promise
Rext
🎈A lightweight (< 5kb gzipped) and Promise-supported HTTP request library, for all browsers.
Stars: ✭ 14 (-70.83%)
Mutual labels: promise
Nodespider
[DEPRECATED] Simple, flexible, delightful web crawler/spider package
Stars: ✭ 33 (-31.25%)
Mutual labels: promise
Vue Loadable
⏳ Improve your loading state control with pretty simple methods and helpers.
Stars: ✭ 23 (-52.08%)
Mutual labels: promise
Assertive
Assertive is a terse yet expressive assertion library
Stars: ✭ 21 (-56.25%)
Mutual labels: promise
Fritzbox.js
☎️ The leading AVM Fritz!Box API for NodeJS and JavaScript.
Stars: ✭ 36 (-25%)
Mutual labels: promise
Create Request
Apply interceptors to `fetch` and create a custom request function.
Stars: ✭ 34 (-29.17%)
Mutual labels: promise
Await Handler
Basic wrapper for await that allows handling of errors without try/catch blocks
Stars: ✭ 13 (-72.92%)
Mutual labels: promise
Node Pg Async
PostgreSQL 🐘 client for node.js designed for easy use with ES7 async/await based on node-postgres
Stars: ✭ 41 (-14.58%)
Mutual labels: promise
Node Qiniu Sdk
七牛云SDK,使用 ES2017 async functions 来操作七牛云,接口名称与官方接口对应,轻松上手,文档齐全
Stars: ✭ 44 (-8.33%)
Mutual labels: promise
Bluebird Api
Bluebird compatible API on top of native promises.
Stars: ✭ 36 (-25%)
Mutual labels: promise
fs-readfile-promise
Promisified version of fs.readFile
const readFilePromise = require('fs-readfile-promise');
(async () => {
const buffer = await readPromise('path/to/a/file');
buffer.toString(); //=> '... file contents ...'
})();
Based on the principle of modular programming, this module has only one functionality readFile
, unlike other Promise-based file system modules. If you'd like to use a bunch of other fs
methods in the Promise way, choose other modules such as q-io and promise-fs.
Installation
npm install fs-readfile-promise
API
const readFilePromise = require('fs-readfile-promise');
readFile(path [, options])
path: string
Buffer
Uint8Array
URL
integer
options: Object
(fs.readFile options) or string
(encoding)
Return: Promise<Buffer|string>
(async () => {
await readFilePromise('src.txt'); //=> <Buffer 48 69 2e>
await readFilePromise('src.txt', 'utf8'); //=> 'Hi.'
await readFilePromise('src.txt', {encoding: 'base64'}); //=> 'SGku'
})();
Related projects
-
read-utf8-file — Promisified
fs.readFile
with automatic BOM stripping, encoding validation and stringification - read-multiple-files — Read multiple files Observable way
License
ISC License © 2017 - 2018 Shinnosuke Watanabe
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].