lib/localPersistence/localPersistenceManager.js
/**
   * Copy the data of a level to another using NodeStreams
   *
   * @param {LevelUp} originLevel level that will be copied
   * @param {LevelUp} targetLevel level that will be the copy
   *
   * @public
   */
Copy the data of a level to another using NodeStreams
@param {LevelUp} originLevel level that will be copied
@param {LevelUp} targetLevel level that will be the copy

@public
Copy the data of a level to another using NodeStreams @param { LevelUp } originLevel level that will be copied @param { LevelUp } targetLevel level that will be the copy @public
static async copyLevel(originLevel, targetLevel) {
    const originLevelReadableStream = originLevel.createKeyStream();
    const targetLevelWritableStream = Writable({
      async write(key, _encoding, cb) {
        const value = await originLevel.get(key.toString());
        targetLevel.put(key.toString(), value);
        cb();
      },
    });
    try {
      await pipelineAsync(
        originLevelReadableStream,
        targetLevelWritableStream,
      );
    } catch (error) {
      this.logger.debug('It was not possible to write the level data.');
      this.logger.debug(error);
    }
  }
static async copyLevel ( originLevel , targetLevel ) { const originLevelReadableStream = originLevel . createKeyStream ( ) ; const targetLevelWritableStream = Writable ( { async write ( key , _encoding , cb ) { const value = await originLevel . get ( key . toString ( ) ) ; targetLevel . put ( key . toString ( ) , value ) ; cb ( ) ; } , } ) ; try { await pipelineAsync ( originLevelReadableStream , targetLevelWritableStream , ) ; } catch ( error ) { this . logger . debug ( 'It was not possible to write the level data.' ) ; this . logger . debug ( error ) ; } }
Copy the data of a level to another using NodeStreams
 @param {LevelUp} originLevel level that will be copied
 @param {LevelUp} targetLevel level that will be the copy
Copy the data of a level to another using NodeStreams @param { LevelUp } originLevel level that will be copied @param { LevelUp } targetLevel level that will be the copy