natiny_resource_save

C
int natiny_resource_save(NatinyResource resource, const char* path);

Writes a resource's bytes to a file, replacing an existing file at that path.

Parameters

Name Type Description
resource NatinyResource Resource handle
path const char* Where to write it; an existing file is overwritten

Returns

Type Description
int 1 when every byte was written, 0 otherwise

Example

C
int ok = natiny_resource_save(resource, "data/copy.bin");

Notes

  • The directory must already exist - this does not create one.
  • The bytes go out exactly as they are: nothing is packed, framed or compressed on the way.
  • A failure is reported on stderr and returns 0; the file may be left partly written.
  • On web, the path is in Emscripten's virtual filesystem and normally persists only for the current page session.