UNPKG

artoolkit5-js

Version:
23 lines (19 loc) 482 B
import axios from 'axios'; export default class Utils { static async fetchRemoteData(url) { try { const response = await axios.get(url, { responseType: 'arraybuffer' }); return new Uint8Array(response.data); } catch(error) { throw error; } } static string2Uint8Data(string) { let data = new Uint8Array(string.length); for(let i = 0; i < data.length; i++) { data[i] = string.charCodeAt(i) & 0xff; } return data; } }