diff --git a/.gitignore b/.gitignore deleted file mode 100644 index eb183dc..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/first-chunk-stream-2.0.0.tgz diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..5204a84 --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +Orphaned for 6+ weeks diff --git a/nodejs-first-chunk-stream.spec b/nodejs-first-chunk-stream.spec deleted file mode 100644 index 9085fad..0000000 --- a/nodejs-first-chunk-stream.spec +++ /dev/null @@ -1,100 +0,0 @@ -%{?nodejs_find_provides_and_requires} - -%global packagename first-chunk-stream -%global enable_tests 1 - -Name: nodejs-first-chunk-stream -Version: 2.0.0 -Release: 10%{?dist} -Summary: Transform the first chunk in a stream - -License: MIT -URL: https://github.com/sindresorhus/first-chunk-stream.git -Source0: https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz -# The test files are not included in the npm tarball. -Source1: https://raw.githubusercontent.com/sindresorhus/first-chunk-stream/v%{version}/test.js - - -BuildArch: noarch -%if 0%{?fedora} >= 19 -ExclusiveArch: %{nodejs_arches} noarch -%else -ExclusiveArch: %{ix86} x86_64 %{arm} noarch -%endif - -BuildRequires: nodejs-packaging -%if 0%{?enable_tests} -BuildRequires: mocha -BuildRequires: npm(streamtest) -%endif - -%description -Transform the first chunk in a stream - - -%prep -%setup -q -n package -# setup the tests -cp -p %{SOURCE1} . - - - -%build -# nothing to do! - -%install -mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} -cp -pr package.json index.js \ - %{buildroot}%{nodejs_sitelib}/%{packagename} - -%nodejs_symlink_deps - -%check -%nodejs_symlink_deps --check -%{__nodejs} -e 'require("./")' -%if 0%{?enable_tests} -%{_bindir}/mocha -R spec -%else -%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" - -%endif - - -%files -%{!?_licensedir:%global license %doc} -%doc *.md -%license license -%{nodejs_sitelib}/%{packagename} - - -%changelog -* Sat Aug 01 2020 Fedora Release Engineering - 2.0.0-10 -- Second attempt - Rebuilt for - https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Tue Jul 28 2020 Fedora Release Engineering - 2.0.0-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Wed Jan 29 2020 Fedora Release Engineering - 2.0.0-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Thu Jul 25 2019 Fedora Release Engineering - 2.0.0-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Fri Feb 01 2019 Fedora Release Engineering - 2.0.0-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Fri Jul 13 2018 Fedora Release Engineering - 2.0.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Thu Feb 08 2018 Fedora Release Engineering - 2.0.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Wed Jul 26 2017 Fedora Release Engineering - 2.0.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Fri Feb 10 2017 Fedora Release Engineering - 2.0.0-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Mon Feb 22 2016 Jared Smith - 2.0.0-1 -- Initial packaging diff --git a/sources b/sources deleted file mode 100644 index b7a0e3f..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -1d0f3696b50c5db8d6d946b39fd23f03 first-chunk-stream-2.0.0.tgz diff --git a/test.js b/test.js deleted file mode 100644 index 7c19777..0000000 --- a/test.js +++ /dev/null @@ -1,373 +0,0 @@ -/* eslint-env mocha */ -'use strict'; -var assert = require('assert'); -var streamtest = require('streamtest'); -var firstChunkStream = require('./'); - -describe('firstChunk()', function () { - var content = 'unicorn rainbows \ncake'; - - describe('should fail', function () { - it('when the callback is not providen', function () { - assert.throws(function () { - firstChunkStream({ - chunkLength: 7 - }); - }); - }); - - it('when trying to use it in objectMode', function () { - assert.throws(function () { - firstChunkStream({ - chunkLength: 7, - objectMode: true - }, function () {}); - }); - }); - - it('when firstChunk size is bad or missing', function () { - assert.throws(function () { - firstChunkStream({ - chunkLength: 'feferf' - }, function () {}); - }); - assert.throws(function () { - firstChunkStream({}.undef, function () {}); - }); - }); - }); - - streamtest.versions.forEach(function (version) { - describe('for ' + version + ' streams', function () { - describe('emitting errors', function () { - it('should report error in the callback before first chunk is sent and allow recovery', function (done) { - var callbackCalled = false; - var stream = firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - assert.equal(err.message, 'Hey!'); - assert.equal(chunk.toString('utf-8'), content.substr(0, 2)); - callbackCalled = true; - - cb(null, new Buffer(content.substr(0, 7))); - }); - - stream.pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - - stream.write(new Buffer(content[0])); - stream.write(new Buffer(content[1])); - stream.emit('error', new Error('Hey!')); - stream.write(new Buffer(content.substr(7))); - stream.end(); - }); - - it('should report error in the callback before first chunk is sent and reemit passed errors', function (done) { - var callbackCalled = false; - var errEmitted = false; - var stream = firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - assert.equal(err.message, 'Hey!'); - callbackCalled = true; - - stream.on('error', function (err) { - assert.equal(err.message, 'Ho!'); - errEmitted = true; - }); - - cb(new Error('Ho!')); - }); - - stream.pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content.substr(7)); - assert(callbackCalled, 'Callback has been called.'); - assert(errEmitted, 'Error has been emitted.'); - - done(); - })); - - stream.write(new Buffer(content[0])); - stream.write(new Buffer(content[1])); - stream.emit('error', new Error('Hey!')); - stream.write(new Buffer(content.substr(7))); - stream.end(); - }); - - it('should just emit errors when first chunk is sent', function (done) { - var callbackCalled = false; - var errEmitted = false; - var stream = firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - callbackCalled = true; - cb(null, chunk); - }); - - stream.on('error', function (err) { - assert.equal(err.message, 'Hey!'); - errEmitted = true; - }); - - stream.pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content); - assert(callbackCalled, 'Callback has been called.'); - assert(errEmitted, 'Error has been emitted.'); - - done(); - })); - - stream.write(new Buffer(content.substr(0, 7))); - stream.emit('error', new Error('Hey!')); - stream.write(new Buffer(content.substr(7))); - stream.end(); - }); - }); - - describe('and require a 0 length first chunk', function () { - it('should work', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks([content]) - .pipe(firstChunkStream({chunkLength: 0}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), ''); - callbackCalled = true; - - cb(null, new Buffer('popop')); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, 'popop' + content); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - }); - - describe('and leaving content as is', function () { - it('should work for a single oversized chunk', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks([content]) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), content.substr(0, 7)); - callbackCalled = true; - - cb(null, chunk); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - - it('should work for required size chunk', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks([content.substr(0, 7), content.substr(7)]) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), content.substr(0, 7)); - callbackCalled = true; - - cb(null, chunk); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - - it('should work for several small chunks', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks(content.split('')) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), content.substr(0, 7)); - callbackCalled = true; - - cb(null, chunk); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - }); - - describe('and insufficient content', function () { - it('should work', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks(['a', 'b', 'c']) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), 'abc'); - callbackCalled = true; - - cb(null, new Buffer('b')); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, 'b'); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - }); - - describe('and changing content', function () { - it('should work when removing the first chunk', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks([content]) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), content.substr(0, 7)); - callbackCalled = true; - - cb(null, new Buffer(0)); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content.substr(7)); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - - it('should work when replacing per a larger chunk', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks([content.substr(0, 7), content.substr(7)]) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), content.substr(0, 7)); - callbackCalled = true; - - cb(null, Buffer.concat([chunk, new Buffer('plop')])); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, content.substr(0, 7) + 'plop' + content.substr(7)); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - - it('should work when replacing per a smaller chunk', function (done) { - var callbackCalled = false; - - streamtest[version].fromChunks(content.split('')) - .pipe(firstChunkStream({chunkLength: 7}, function (err, chunk, enc, cb) { - if (err) { - done(err); - return; - } - - assert.equal(chunk.toString('utf-8'), content.substr(0, 7)); - callbackCalled = true; - - cb(null, new Buffer('plop')); - })) - .pipe(streamtest[version].toText(function (err, text) { - if (err) { - done(err); - return; - } - - assert.deepEqual(text, 'plop' + content.substr(7)); - assert(callbackCalled, 'Callback has been called.'); - - done(); - })); - }); - }); - }); - }); -});