LDK_PACKAGE_FILE_EXTENSION
#define LDK_PACKAGE_FILE_EXTENSION ".box"
Read and write uncompressed BOX asset packages, inspect entries, and extract stored files.
#define LDK_PACKAGE_FILE_EXTENSION ".box"
#define LDK_PACKAGE_PATH_MAX_LENGTH 511u
typedef struct LDKPackage LDKPackage;
typedef struct LDKPackageEntry LDKPackageEntry;
typedef struct LDKPackageWriter LDKPackageWriter;
typedef enum LDKPackageCompression{
LDK_PACKAGE_COMPRESSION_NONE=0
}LDKPackageCompression;
Validate a logical path within a BOX package.
LDK_API bool ldk_package_path_is_valid(const char *path);
const char *pathTrue when the queried condition holds; false otherwise.
Compute the FNV-1a hash of a package file.
LDK_API bool ldk_package_file_hash(
const char *path,
u64 *out_hash
);
const char *pathu64 *out_hashTrue if the operation succeeds; false otherwise.
Open a BOX package and read its manifest. The reader keeps the package file open until ldk_package_close() is called.
LDK_API LDKPackage * ldk_package_open(const char *path);
const char *pathPointer to the requested object or data; NULL when unavailable.
Close an open package and release its reader resources.
LDK_API void ldk_package_close(LDKPackage *package);
LDKPackage *packageCount the package entry.
LDK_API u32 ldk_package_entry_count(const LDKPackage *package);
const LDKPackage *packageNumber of matching entries.
Get the package entry by index.
LDK_API const LDKPackageEntry * ldk_package_entry_at(
const LDKPackage *package,
u32 index
);
const LDKPackage *packageu32 indexPointer to the requested object or data; NULL when unavailable.
Find the package entry.
LDK_API const LDKPackageEntry * ldk_package_entry_find(
const LDKPackage *package,
const char *path
);
const LDKPackage *packageconst char *pathPointer to the requested object or data; NULL when unavailable.
Get the logical path of a package entry.
LDK_API const char * ldk_package_entry_get_path(const LDKPackageEntry *entry);
const LDKPackageEntry *entryPointer to the requested object or data; NULL when unavailable.
Get the uncompressed byte size of an entry.
LDK_API u64 ldk_package_entry_get_size(const LDKPackageEntry *entry);
const LDKPackageEntry *entrySize of the result, in bytes where applicable.
Get the stored byte size of an entry.
LDK_API u64 ldk_package_entry_get_stored_size(const LDKPackageEntry *entry);
const LDKPackageEntry *entrySize of the result, in bytes where applicable.
Get the compression mode of a package entry.
LDK_API LDKPackageCompression ldk_package_entry_get_compression(const LDKPackageEntry *entry);
const LDKPackageEntry *entryThe requested value.
Read a byte range from an uncompressed package entry. Reaching the end of an entry is not an error. The out_read parameter reports the number of bytes copied.
LDK_API bool ldk_package_entry_read_at(
const LDKPackage *package,
const LDKPackageEntry *entry,
u64 offset,
void *out_data,
u64 size,
u64 *out_read
);
const LDKPackage *packageconst LDKPackageEntry *entryu64 offsetvoid *out_datau64 sizeu64 *out_readTrue if the operation succeeds; false otherwise.
Copy an entire uncompressed package entry into caller-provided memory. The destination must have at least ldk_package_entry_get_size(entry) bytes available.
LDK_API bool ldk_package_entry_read(
LDKPackage *package,
const LDKPackageEntry *entry,
void *out_data,
u64 out_size
);
LDKPackage *packageconst LDKPackageEntry *entryvoid *out_datau64 out_sizeTrue if the operation succeeds; false otherwise.
Extract one package entry to a filesystem path.
LDK_API bool ldk_package_entry_extract(
LDKPackage *package,
const LDKPackageEntry *entry,
const char *destination_path
);
LDKPackage *packageconst LDKPackageEntry *entryconst char *destination_pathTrue if the operation succeeds; false otherwise.
Extract every package entry below the requested destination directory.
LDK_API bool ldk_package_extract_all(
LDKPackage *package,
const char *destination_directory
);
LDKPackage *packageconst char *destination_directoryTrue if the operation succeeds; false otherwise.
Create the package writer. An unfinished output file is removed if the writer is destroyed before finalization.
LDK_API LDKPackageWriter * ldk_package_writer_create(const char *path);
const char *pathPointer to the requested object or data; NULL when unavailable.
Add an existing filesystem file to a package being written.
LDK_API bool ldk_package_writer_add_file(
LDKPackageWriter *writer,
const char *source_path,
const char *package_path,
LDKPackageCompression compression
);
LDKPackageWriter *writerconst char *source_pathconst char *package_pathLDKPackageCompression compressionTrue if the operation succeeds; false otherwise.
Finish writing the package and its manifest.
LDK_API bool ldk_package_writer_finalize(LDKPackageWriter *writer);
LDKPackageWriter *writerTrue if the operation succeeds; false otherwise.
Destroy the package writer.
LDK_API void ldk_package_writer_destroy(LDKPackageWriter *writer);
LDKPackageWriter *writer