Update to new name

master
Sven Slootweg 3 years ago
parent 99cfa7e688
commit b71f1e8b7f

@ -1,19 +1,19 @@
# @ppstreams/end-of-stream-marker # @promistream/end-of-stream
<!-- FIXME: Uncomment the below when 1.0.0 is hit --> <!-- FIXME: Uncomment the below when 1.0.0 is hit -->
<!-- __This module is compatible with the [ppstreams](https://ppstreams.cryto.net/) standard, version 1.0.0 - the latest at the time of writing.__ --> <!-- __This module is compatible with the [Promistream](https://promistream.cryto.net/) standard, version 1.0.0 - the latest at the time of writing.__ -->
A simple custom error type for marking the end of a [ppstreams](https://ppstreams.cryto.net/) stream. You'd usually only need this module when you're implementing a source stream. A simple custom error type for marking the end of a [Promistream](https://promistream.cryto.net/). You'd usually only need this module when you're implementing a source stream.
## Example ## Example
An example of *producing* an `EndOfStream` marker, from the [range-numbers](https://www.npmjs.com/package/@ppstreams/range-numbers) module, which is a source stream that produces numbers within a range: An example of *producing* an `EndOfStream` marker, from the [range-numbers](https://www.npmjs.com/package/@promistream/range-numbers) module, which is a source stream that produces numbers within a range:
```js ```js
"use strict"; "use strict";
const simpleSource = require("@ppstreams/simple-source"); const simpleSource = require("@promistream/simple-source");
const EndOfStream = require("@ppstreams/end-of-stream"); const EndOfStream = require("@promistream/end-of-stream");
module.exports = function rangeNumbers(start, end, step = 1) { module.exports = function rangeNumbers(start, end, step = 1) {
let i = start; let i = start;
@ -33,14 +33,14 @@ module.exports = function rangeNumbers(start, end, step = 1) {
``` ```
<!-- FIXME: Move below to is-end-of-stream and link from here, also update the example code to use the newer APIs <!-- FIXME: Move below to is-end-of-stream and link from here, also update the example code to use the newer APIs
An example of *detecting* an `EndOfStream` marker, from the [simple-sink](https://git.cryto.net/ppstreams/simple-sink) module, which just keeps pulling values until the end of the stream: An example of *detecting* an `EndOfStream` marker, from the [simple-sink](https://git.cryto.net/promistream/simple-sink) module, which just keeps pulling values until the end of the stream:
```js ```js
"use strict"; "use strict";
const Promise = require("bluebird"); const Promise = require("bluebird");
const propagateAbort = require("@ppstreams/propagate-abort"); const propagateAbort = require("@promistream/propagate-abort");
const { isEndOfStream } = require("@ppstreams/is-end-of-stream"); const { isEndOfStream } = require("@promistream/is-end-of-stream");
module.exports = function greedySinkStream(description, callback) { module.exports = function greedySinkStream(description, callback) {
return { return {

@ -2,6 +2,8 @@
const EndOfStream = require("./"); const EndOfStream = require("./");
// TODO: Turn this into a meaningful example
let marker = new EndOfStream(); let marker = new EndOfStream();
console.log(marker); // Logs the new EndOfStream (Error) instance console.log(marker); // Logs the new EndOfStream (Error) instance

@ -3,13 +3,12 @@
const createError = require("error-chain").create; const createError = require("error-chain").create;
const defaultValue = require("default-value"); const defaultValue = require("default-value");
// FIXME: Update everything that uses end-of-stream-marker or aborted-marker to the new split-module API
module.exports = createError("EndOfStream", { module.exports = createError("EndOfStream", {
populate: (message) => { populate: (message) => {
return { message: defaultValue(message, "There is no more data to read") }; return { message: defaultValue(message, "There is no more data to read") };
}, },
context: { context: {
__ppstreams_isEndOfStreamMarker: true, _promistreamIsEndOfStreamMarker: true,
__ppstreams_specVersion: 1 _promistreamVersion: 1
} }
}); });

@ -1,8 +1,8 @@
{ {
"name": "@ppstreams/end-of-stream", "name": "@promistream/end-of-stream",
"version": "0.1.1", "version": "0.1.1",
"main": "index.js", "main": "index.js",
"repository": "http://git.cryto.net/ppstreams/end-of-stream.git", "repository": "http://git.cryto.net/promistream/end-of-stream.git",
"author": "Sven Slootweg <admin@cryto.net>", "author": "Sven Slootweg <admin@cryto.net>",
"license": "WTFPL OR CC0-1.0", "license": "WTFPL OR CC0-1.0",
"dependencies": { "dependencies": {

Loading…
Cancel
Save