convert to blob

This commit is contained in:
Jade (Rose) Rowland 2024-06-01 12:11:28 -04:00
parent 1fca6f25b8
commit 1fd9ba5dbf

View File

@ -64,7 +64,7 @@ export function registerSamplesFromDB(config = userSamplesDBConfig, onComplete =
//fallback to file name before period and seperator if no parent directory
splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user';
const soundPath = bufferToDataUrl(soundFile.buf);
const soundPath = blobToDataUrl(soundFile.blob);
// const soundPath = soundFile.blob;
const soundPaths = sounds.get(parentDirectory) ?? new Set();
@ -164,16 +164,16 @@ async function processFilesForIDB(files) {
const sUrl = URL.createObjectURL(s);
//fetch the sound and turn it into a buffer array
return fetch(sUrl).then((res) => {
return res.arrayBuffer().then((buf) => {
return res.blob().then((blob) => {
const path = s.webkitRelativePath;
let id = path?.length ? path : title;
if (id == null || title == null || buf == null) {
if (id == null || title == null || blob == null) {
return;
}
return {
title,
buf,
// blob: base64,
// buf,
blob,
id,
};
});