mirror of
https://github.com/core-hn/pseudobsidian-ization.git
synced 2026-07-22 06:57:06 +00:00
fix: avoid unnecessary type assertion when importing audio buffers
This commit is contained in:
parent
8db091faf6
commit
af0ae3d720
2 changed files with 4 additions and 2 deletions
3
main.js
3
main.js
|
|
@ -38095,7 +38095,8 @@ var PseudObsPlugin = class extends import_obsidian15.Plugin {
|
|||
}
|
||||
const buffer = await nodeFs.promises.readFile(sourcePath);
|
||||
await this.ensureFolder(targetFolder);
|
||||
const arrayBuf = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
|
||||
const arrayBuf = new ArrayBuffer(buffer.byteLength);
|
||||
new Uint8Array(arrayBuf).set(buffer);
|
||||
await this.app.vault.createBinary(destPath, arrayBuf);
|
||||
new import_obsidian15.Notice(t("notice.audioImported", audioFilename));
|
||||
return audioFilename;
|
||||
|
|
|
|||
|
|
@ -1010,7 +1010,8 @@ export default class PseudObsPlugin extends Plugin {
|
|||
|
||||
const buffer: Buffer = await nodeFs.promises.readFile(sourcePath);
|
||||
await this.ensureFolder(targetFolder);
|
||||
const arrayBuf = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength) as ArrayBuffer;
|
||||
const arrayBuf = new ArrayBuffer(buffer.byteLength);
|
||||
new Uint8Array(arrayBuf).set(buffer);
|
||||
await this.app.vault.createBinary(destPath, arrayBuf);
|
||||
new Notice(t('notice.audioImported', audioFilename));
|
||||
return audioFilename;
|
||||
|
|
|
|||
Loading…
Reference in a new issue