temp-write

WebJar for temp-write

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

temp-write
Last Version

Last Version

3.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

temp-write
WebJar for temp-write
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/temp-write

Download temp-write

How to add to project

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

Dependencies

compile (6)

Group / Artifact Type Version
org.webjars.npm : graceful-fs jar [4.1.2,5)
org.webjars.npm : is-stream jar [1.1.0,2)
org.webjars.npm : make-dir jar [1.0.0,2)
org.webjars.npm : temp-dir jar [1.0.0,2)
org.webjars.npm : uuid jar [3.0.1,4)
org.webjars.npm : pify jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

temp-write

Write string/buffer/stream to a random temp file

Install

$ npm install temp-write

Usage

const fs = require('fs');
const tempWrite = require('temp-write');

const filePath = tempWrite.sync('unicorn');
//=> '/var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b'

fs.readFileSync(filePath, 'utf8');
//=> 'unicorn'


tempWrite.sync('unicorn', 'pony.png');
//=> '/var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b/pony.png'

tempWrite.sync('unicorn', 'rainbow/cake/pony.png');
//=> '/var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b/rainbow/cake/pony.png'

API

tempWrite(fileContent, filePath?)

Returns a Promise for the file path of the temp file.

tempWrite.sync(fileContent, filePath?)

Returns the file path of the temp file.

fileContent

Type: string | Buffer | stream.Readable

Data to write to the temp file. Streams are supported only with the async API.

filePath

Type: string
Examples: 'img.png' 'foo/bar/baz.png'

Optionally supply a file path which is appended to the random path.

Related

  • tempy - Get a random temporary file or directory path

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
3.4.0