lib/services/db.js
function list(options = {}) {
  options = _.defaults(options, {
    limit: -1,
    keys: true,
    values: true,
    fillCache: false,
    json: true
  });

  // The prefix option is a shortcut for a greaterThan and lessThan range.
  if (options.prefix) {
    // \x00 is the first possible alphanumeric character, and \xFF is the last
    options.gte = options.prefix + '\x00';
    options.lte = options.prefix + '\xff';
  }

  let readStream,
    transformOptions = {
      objectMode: options.values,
      isArray: options.isArray
    };

  // if keys but no values, or values but no keys, always return as array.
  if (options.keys && !options.values || !options.keys && options.values) {
    transformOptions.isArray = true;
  }

  readStream = module.exports.createReadStream(options);

  if (_.isFunction(options.transforms)) {
    options.transforms = options.transforms();
  }

  // apply all transforms
  if (options.transforms) {
    readStream = _.reduce(options.transforms, function (readStream, transform) {
      return readStream.pipe(transform);
    }, readStream);
  }

  if (options.json) {
    readStream = readStream.pipe(jsonTransform(transformOptions));
  }

  return readStream;
}
function list(options = {}) {
  options = _.defaults(options, {
    limit: -1,
    keys: true,
    values: true,
    fillCache: false,
    json: true
  });

  // The prefix option is a shortcut for a greaterThan and lessThan range.
  if (options.prefix) {
    // \x00 is the first possible alphanumeric character, and \xFF is the last
    options.gte = options.prefix + '\x00';
    options.lte = options.prefix + '\xff';
  }

  let readStream,
    transformOptions = {
      objectMode: options.values,
      isArray: options.isArray
    };

  // if keys but no values, or values but no keys, always return as array.
  if (options.keys && !options.values || !options.keys && options.values) {
    transformOptions.isArray = true;
  }

  readStream = module.exports.createReadStream(options);

  if (_.isFunction(options.transforms)) {
    options.transforms = options.transforms();
  }

  // apply all transforms
  if (options.transforms) {
    readStream = _.reduce(options.transforms, function (readStream, transform) {
      return readStream.pipe(transform);
    }, readStream);
  }

  if (options.json) {
    readStream = readStream.pipe(jsonTransform(transformOptions));
  }

  return readStream;
}
function list ( options = { } ) { options = _ . defaults ( options , { limit : - 1 , keys : true , values : true , fillCache : false , json : true } ) ; // The prefix option is a shortcut for a greaterThan and lessThan range. if ( options . prefix ) { // \x00 is the first possible alphanumeric character, and \xFF is the last options . gte = options . prefix + '\x00' ; options . lte = options . prefix + '\xff' ; } let readStream , transformOptions = { objectMode : options . values , isArray : options . isArray } ; // if keys but no values, or values but no keys, always return as array. if ( options . keys && ! options . values || ! options . keys && options . values ) { transformOptions . isArray = true ; } readStream = module . exports . createReadStream ( options ) ; if ( _ . isFunction ( options . transforms ) ) { options . transforms = options . transforms ( ) ; } // apply all transforms if ( options . transforms ) { readStream = _ . reduce ( options . transforms , function ( readStream , transform ) { return readStream . pipe ( transform ) ; } , readStream ) ; } if ( options . json ) { readStream = readStream . pipe ( jsonTransform ( transformOptions ) ) ; } return readStream ; }
Get a read stream of all the keys.

@example db.list({prefix: '/_components/hey'})

WARNING:  Try to always end with the same character (like a /) or be completely consistent with your prefixing
because the '/' character is right in the middle of the sorting range of characters.  You will get weird results
if you're not careful with your ending character.  For example, `/_components/text` will also return the entries of
`/_components/text-box`, so the search should really be `/_components/text/`.

@param {object} [options]
@returns {ReadStream}
 /* eslint-disable complexity
Get a read stream of all the keys .