1.0.10 • Published 7 years ago

fs-write-stream-atomic v1.0.10

Weekly downloads
10,792,814
License
ISC
Repository
github
Last release
7 years ago

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'
move-concurrentlycopy-concurrentlyvuedragdropuploadimageskilli8n-react-native-fast-image@cashremit/cr-streamline-iconsbb-chat@frxf/frxf@fundefund/funde_ckgql_din_mod@l1nyanm1ng/react-picture-viewerjs4cytoscape@saaspe/components@everything-registry/sub-chunk-1706drs-extracteditorjs-alerticonsdfeuk-frontend-manualeasyplayer-mydwaalfirst-app-lyfucifastlion-picture-viewerfn-lib-example@simstudio/htmldiff@openpolitica/matomo-next@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdownflowable-bpmn-modelerfork-react-ffmpegfengdiefetch-ficforminput-ui-libfrdrk-js-semaphorejmpr-jpmjameslinenode.js1jamuskaliml2forlernahot-zone-vuehubot-budagrid-component-react-ex-1guruwayguruway.jsjesusdemoyss-perseusiotor-lmhelp-widget@jarrydark/editorsimplejs@icetee/react-recaptcha-v3myreuselibrarymyui5librarychenmyui5librarymobo@meysam213/react-leafletnaver-bowernaver-npm@innodata/vue-v3-ya-metrika@inti-ar/evm-chainsksayapmlocked-atomic-ws@ikon-x/ckeditor5-custom-build-for-irrosoft@krwhitley/neataptic@kuinox/testpackagethatnooneshoulduse@kuinox/testpackagethatnooneshoulduseever@jasonssun/npm@lego-js/testsmiracle-webpack-tree-shaking@kristoffertonning/vue-laravel-errorsmiguelcostero-ng2-toasty@hproinformatica/functionsm2m-chartjs-plugin-crosshairlitepie-datepicker-gabe@kirrosh/pts@react-18-pdf/root@rbc-public/react-selectable-fast@percent/percent-api-hooksnpm-for-cnpmnpm-msys2nst-clinull-session-npmpageres-integration@podlubnaja/ui-kitparvan_componentsparvan_reactjs_components@poondestroyer/signois-react-toastnot-bundled-npmng-search-dropdown@mrauhu/npmnpm-2@safely-project/safely-ts@salomvary/npm@sackmanson/quill-image-uploaderprova-2-caroselloprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4@npmcorp/movenpm-prog@npmcorp/copynpm5npm5vnpmc
1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago