All Projects → shinnn → Fs Readfile Promise

shinnn / Fs Readfile Promise

Licence: isc
Promisified version of fs.readFile

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
Breeze
Javascript async flow control manager
Stars: ✭ 38 (-20.83%)
Mutual labels:  promise
Rext
🎈A lightweight (< 5kb gzipped) and Promise-supported HTTP request library, for all browsers.
Stars: ✭ 14 (-70.83%)
Mutual labels:  promise
Promise
Promise-在Java中以同步的方式异步编程
Stars: ✭ 20 (-58.33%)
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
School Kr
🍚🍴 전국 교육청 급식, 학사일정 파싱 라이브러리
Stars: ✭ 44 (-8.33%)
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
Vsphere Connect
A modern vSphere Client
Stars: ✭ 14 (-70.83%)
Mutual labels:  promise
Zcoil
Elegant access to data
Stars: ✭ 20 (-58.33%)
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
Jocs.github.io
💯Jocs 的个人博客,所有的文章都在 issues 里面
Stars: ✭ 840 (+1650%)
Mutual labels:  promise
Promise.hpp
C++ asynchronous promises like a Promises/A+
Stars: ✭ 31 (-35.42%)
Mutual labels:  promise
Emacs Async Await
Async/Await for Emacs
Stars: ✭ 47 (-2.08%)
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

npm version Build Status Build status Coverage Status

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

Use npm.

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

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].