fs-readfile-promise

WebJar for fs-readfile-promise

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

fs-readfile-promise
Последняя версия

Последняя версия

2.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

fs-readfile-promise
WebJar for fs-readfile-promise
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/shinnn/fs-readfile-promise

Скачать fs-readfile-promise

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/fs-readfile-promise/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>fs-readfile-promise</artifactId>
    <version>2.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/fs-readfile-promise/
implementation 'org.webjars.npm:fs-readfile-promise:2.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/fs-readfile-promise/
implementation ("org.webjars.npm:fs-readfile-promise:2.0.1")
'org.webjars.npm:fs-readfile-promise:jar:2.0.1'
<dependency org="org.webjars.npm" name="fs-readfile-promise" rev="2.0.1">
  <artifact name="fs-readfile-promise" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='fs-readfile-promise', version='2.0.1')
)
libraryDependencies += "org.webjars.npm" % "fs-readfile-promise" % "2.0.1"
[org.webjars.npm/fs-readfile-promise "2.0.1"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : graceful-fs jar [4.1.2,5)

Модули Проекта

Данный проект не имеет модулей.

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

Версии библиотеки

Версия
2.0.1