How to use the @parcel/utils.deserialize function in @parcel/utils

To help you get started, we’ve selected a few @parcel/utils 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 parcel-bundler / parcel / packages / core / cache / src / HTTPCache.js View on Github external
let response;
    try {
      response = await this.request(this._getCachePath(key), {
        method: 'get',
        encoding: null
      });
    } catch (e) {
      if (e.name === 'HTTPError') {
        // TODO: Log 500+ verbosely?
        return null;
      } else {
        throw e;
      }
    }

    return deserialize(response.body);
  }
github parcel-bundler / parcel / packages / core / cache / src / FSCache.js View on Github external
async get(key: string) {
    try {
      let data = await this.fs.readFile(this._getCachePath(key));
      return deserialize(data);
    } catch (err) {
      if (err.code === 'ENOENT') {
        return null;
      } else {
        throw err;
      }
    }
  }
github parcel-bundler / parcel / packages / core / workers / src / process / ProcessChild.js View on Github external
handleMessage(data: string) {
    if (data === 'die') {
      return this.stop();
    }

    this.onMessage(deserialize(Buffer.from(data, 'base64')));
  }
github parcel-bundler / parcel / packages / core / cache / src / Cache.js View on Github external
async get(key: string) {
    try {
      let data = await this.fs.readFile(this._getCachePath(key));
      return deserialize(data);
    } catch (err) {
      if (err.code === 'ENOENT') {
        return null;
      } else {
        throw err;
      }
    }
  }
github parcel-bundler / parcel / packages / core / workers / src / process / ProcessWorker.js View on Github external
this.child.on('message', (data: string) => {
      this.onMessage(deserialize(Buffer.from(data, 'base64')));
    });