Tilde Friends
File Interface

Typedefs

typedef struct JSContext JSContext
 
typedef struct _tf_task_t tf_task_t
 

Functions

void tf_file_register (JSContext *context)
 
void tf_file_stat (tf_task_t *task, const char *path, void(*callback)(tf_task_t *task, const char *path, int result, const uv_stat_t *stat, void *user_data), void *user_data)
 
void tf_file_read (tf_task_t *task, const char *path, void(*callback)(tf_task_t *task, const char *path, int result, const void *data, void *user_data), void *user_data)
 

Detailed Description

Exposes an operating system file I/O API to script.

Typedef Documentation

◆ JSContext

typedef struct JSContext JSContext

A JS context.

◆ tf_task_t

typedef struct _tf_task_t tf_task_t

A task.

Function Documentation

◆ tf_file_read()

void tf_file_read ( tf_task_t task,
const char *  path,
void(*)(tf_task_t *task, const char *path, int result, const void *data, void *user_data)  callback,
void *  user_data 
)

Asynchronously read a file's contents.

Parameters
taskThe running task.
pathThe path to the file.
callbackA callback that will be called with the file contents.
user_dataUser data that will be provided to the callback.

◆ tf_file_register()

void tf_file_register ( JSContext context)

Register the file script interface.

Parameters
contextThe JS context.

◆ tf_file_stat()

void tf_file_stat ( tf_task_t task,
const char *  path,
void(*)(tf_task_t *task, const char *path, int result, const uv_stat_t *stat, void *user_data)  callback,
void *  user_data 
)

Asynchronously stat() a file.

Parameters
taskThe running task.
pathThe path to the file to stat().
callbackA function that will be called with the stat result.
user_dataUser data that will be passed to the callback.