How to use the get-stream function in get-stream

To help you get started, we’ve selected a few get-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github semantic-release / semantic-release / test / helpers / mockserver.js View on Github external
async function start() {
  await getStream(await docker.pull(IMAGE));

  container = await docker.createContainer({
    Tty: true,
    Image: IMAGE,
    PortBindings: {[`${MOCK_SERVER_PORT}/tcp`]: [{HostPort: `${MOCK_SERVER_PORT}`}]},
  });
  await container.start();

  try {
    // Wait for the mock server to be ready
    await pRetry(() => got.put(`http://${MOCK_SERVER_HOST}:${MOCK_SERVER_PORT}/status`, {cache: false}), {
      retries: 7,
      minTimeout: 1000,
      factor: 2,
    });
  } catch (_) {
github semantic-release / semantic-release / test / helpers / npm-registry.js View on Github external
async function start() {
  await getStream(await docker.pull(IMAGE));

  container = await docker.createContainer({
    Tty: true,
    Image: IMAGE,
    PortBindings: {[`${COUCHDB_PORT}/tcp`]: [{HostPort: `${SERVER_PORT}`}]},
    Env: [`COUCHDB_USER=${COUCHDB_USER}`, `COUCHDB_PASSWORD=${COUCHDB_PASSWORD}`],
  });

  await container.start();
  await delay(4000);

  try {
    // Wait for the registry to be ready
    await pRetry(() => got(`http://${SERVER_HOST}:${SERVER_PORT}/registry/_design/app`, {cache: false}), {
      retries: 7,
      minTimeout: 1000,
github lukechilds / cacheable-request / test / cache.js View on Github external
cacheableRequest(opts, async response => {
		const body = await getStream(response);
		response.body = body;

		// Give the cache time to update
		await delay(100);

		resolve(response);
	})
		.on('request', req => req.end())
github staeco / iris-ql / test / Query / executeStream.js View on Github external
it('should work with format and pumpify', async () => {
    const query = new Query({ limit: 1 }, { model: user.scope('public') })
    const stream = await query.executeStream({
      format: json
    })
    should(stream.contentType).eql(json.contentType)
    const res = await collect(pumpify.obj(
      stream,
      through2()
    ))
    should(typeof res).eql('string')
    const parsed = JSON.parse(res)
    parsed.length.should.equal(1)
    should.not.exist(parsed[0].authToken)
    should.exist(parsed[0].name)
  })
  it('should execute with proper model name', async () => {
github szmarczak / http2-wrapper / test / headers.js View on Github external
test('removing headers', wrapper, async (t, server) => {
	const request = makeRequest(server.options);
	request.setHeader('foo', 'bar');
	request.removeHeader('foo');
	request.end();

	const res = await pEvent(request, 'response');
	const data = JSON.parse(await getStream(res));
	t.is(data.headers.foo, undefined);
});
github ehmicky / gulp-execa / test / helpers / gulpfiles / stream.js View on Github external
const stringifyContents = function({ contents, execa }) {
  if (execa !== undefined) {
    return JSON.stringify(execa, null, 2)
  }

  if (Buffer.isBuffer(contents)) {
    return contents.toString()
  }

  return getStream(contents)
}
github lukechilds / cacheable-request / test / cacheable-request-instance.js View on Github external
cacheableRequest(s.url, async response => {
		const body = await getStream(response);
		t.is(body, 'hi');
		t.end();
	}).on('request', req => req.end());
});
github ewnd9 / dictionary-cli / test / translate-spec.js View on Github external
const exec = args => {
  const cp = spawn(path.resolve(__dirname, 'fixtures', 'cli.es6.js'), args);
  cp.stdout.setEncoding('utf8');
  cp.stderr.setEncoding('utf8');

  return Promise
    .all([
      getStream(cp.stdout),
      getStream(cp.stderr)
        .then(res => {
          if (res.length > 0) {
            throw new Error(res);
          }
        })
    ])
    .then(([ stdout, stderr ]) => stdout);
};
github semantic-release / git / test / helpers / gitbox.js View on Github external
async function start() {
  await getStream(await docker.pull(IMAGE));

  container = await docker.createContainer({
    Tty: true,
    Image: IMAGE,
    PortBindings: {[`${SERVER_PORT}/tcp`]: [{HostPort: `${HOST_PORT}`}]},
  });
  await container.start();

  const exec = await container.exec({
    Cmd: ['ng-auth', '-u', GIT_USERNAME, '-p', GIT_PASSWORD],
    AttachStdout: true,
    AttachStderr: true,
  });
  await exec.start();
}

get-stream

Get a stream as a string, Buffer, ArrayBuffer or array

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis

Popular get-stream functions