io/utils

Utility functions of various sorts in support of IO packages.

Source:
Example
const { BinaryReader } = require('@jscad/io-utils')

Methods

(static) convertToBlob(input) → {Blob}

Source:

Convert the given input into a BLOB of data for export.

Example
const blob1 = convertToBlob({ data: ['test'], mimeType: 'text/plain' })
const blob2 = convertToBlob({ data: [Int32Array.from('12345').buffer], mimeType: 'application/mine' })
Parameters:
Name Type Description
input Object

input object to convert

Properties
Name Type Description
data Array

array of data to be inserted into the blob, either String or ArrayBuffer

mimeType String

mime type of the data to be inserted

Returns:

a new Blob

Type
Blob

(static) makeBlob() → {function}

Source:

Make a constructor for Blob objects.

Example
const Blob = makeBlob()
const ablob = new Blob(data, { type: mimeType })
Returns:

constructor of Blob objects

Type
function