function asDeserializedBuffer(value: any): Buffer | null {
  if (Buffer.isBuffer(value)) {
    return value;
  }
  if (value && value.type === 'Buffer') {
    return Buffer.from(value.data);
  }
  if (ArrayBuffer.isView(value)) {
    return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
  }
  return null;
}
When the `Buffer` is sent over the worker thread it gets serialized into a JSON object.
This helper method will deserialize it if needed.

@returns `Buffer` representation of the JSON object.
@returns `null` if the given object is nullish or not a serialized `Buffer` object.