Skip to content

Function: createFileRef() ​

Creates a validated file reference from a hash or in-memory content.

ts
import { createFileRef } from 'osu-files'

const ref = createFileRef('audio.mp3', { hash: 'a'.repeat(64) })

return { filename: ref.filename, hash: ref.hash }

Call Signature ​

createFileRef(filename, source, ctx?): FileRef

Defined in: src/beatmap/migrate.ts:31

Parameters ​

ParameterType
filenamestring
source{ content?: Buffer<ArrayBufferLike>; hash?: string; }
source.content?Buffer<ArrayBufferLike>
source.hash?string
ctx?OsuFilesContext

Returns ​

FileRef

Released under the MIT License.