fs-write-stream-atomic

WebJar for fs-write-stream-atomic

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

fs-write-stream-atomic
Last Version

Last Version

1.0.10
Release Date

Release Date

Type

Type

jar
Description

Description

fs-write-stream-atomic
WebJar for fs-write-stream-atomic
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/npm/fs-write-stream-atomic

Download fs-write-stream-atomic

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.npm : graceful-fs jar [4.1.2,5)
org.webjars.npm : iferr jar [0.1.5,0.2)
org.webjars.npm : imurmurhash jar [0.1.4,0.2)
org.webjars.npm : readable-stream jar [1,2),[2,3)

Project Modules

There are no modules declared in this project.

fs-write-stream-atomic

Like fs.createWriteStream(...), but atomic.

Writes to a tmp file and does an atomic fs.rename to move it into place when it's done.

First rule of debugging: It's always a race condition.

USAGE

var fsWriteStreamAtomic = require('fs-write-stream-atomic')
// options are optional.
var write = fsWriteStreamAtomic('output.txt', options)
var read = fs.createReadStream('input.txt')
read.pipe(write)

// When the write stream emits a 'finish' or 'close' event,
// you can be sure that it is moved into place, and contains
// all the bytes that were written to it, even if something else
// was writing to `output.txt` at the same time.

fsWriteStreamAtomic(filename, [options])

  • filename {String} The file we want to write to
  • options {Object}
    • chown {Object} User and group to set ownership after write
      • uid {Number}
      • gid {Number}
    • encoding {String} default = 'utf8'
    • mode {Number} default = 0666
    • flags {String} default = 'w'
org.webjars.npm

npm

node package manager

Versions

Version
1.0.10
1.0.8