libgpac
Documentation of the core library of GPAC
_FileIOFactory Interface Reference

import"nodejs.idl";

Public Member Functions

boolean open (DOMString URL, DOMString mode, _FileIO parent)
 
void close ()
 
unsigned long read (Uint8Array buffer)
 
unsigned long write (Uint8Array buffer)
 
unsigned long seek (unsigned long long position, unsigned long whence)
 
unsigned long long tell ()
 
boolean eof ()
 
boolean exists (DOMString URL)
 

Detailed Description

interface object for file IO

Member Function Documentation

◆ open()

boolean _FileIOFactory::open ( DOMString  URL,
DOMString  mode,
_FileIO  parent 
)

open a URL

Parameters
URLthe final URL to open
modethe open mode as in gf_fopen
parentthe parent _FileIO object
Returns
true if success, false if error
Note
When opening a file, a new empty object is created and open is called with this being the new object. The object will be kept live until the file is closed.
There is no guarantee that the URL is checked for existence before calling open
There is no guarantee that the first call to open is on the URL provided for the constructor (e.g. for DASH generation, this will depend on the DASH profile used which may require to write the manifest after one or more segments)
Warning
This callback MUST be provided in the factory object

◆ close()

void _FileIOFactory::close ( )

close the file object

Warning
This callback MUST be provided in the factory object

◆ read()

unsigned long _FileIOFactory::read ( Uint8Array  buffer)

read the file object from its current position

Parameters
bufferthe buffer to read
Returns
the number of bytes read into the buffer

This callback can be omitted for write-only files

◆ write()

unsigned long _FileIOFactory::write ( Uint8Array  buffer)

write the file object from its current position

Parameters
bufferthe buffer to read
Returns
the number of bytes written to file

This callback can be omitted for read-only files

◆ seek()

unsigned long _FileIOFactory::seek ( unsigned long long  position,
unsigned long  whence 
)

seek the file object - see gf_fseek

Parameters
positionthe position in the file
whencethe offset in the file (0: begin, 1: current position, 2: end)
Returns
0 if no error, error code otherwise
Warning
This callback MUST be provided in the factory object

◆ tell()

unsigned long long _FileIOFactory::tell ( )

get position in the file object - see gf_ftell

Returns
position in the file
Warning
This callback MUST be provided in the factory object

◆ eof()

boolean _FileIOFactory::eof ( )

check if file position is at end of file - see gf_feof

Returns
true if end of file is reached, false otherwise
Warning
This callback MUST be provided in the factory object

◆ exists()

boolean _FileIOFactory::exists ( DOMString  URL)

check if the given file exists - see gf_file_exists

Parameters
URLthe final URL to open
Returns
true if file exists, false otherwise