Added directory/file exists
This commit is contained in:
@@ -312,6 +312,37 @@ export const get_file_attributes = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const get_file_attributes2 = async (
|
||||
conn,
|
||||
remote_path,
|
||||
optional_thread_id
|
||||
) => {
|
||||
try {
|
||||
const request = new packet();
|
||||
request.encode_utf8(remote_path);
|
||||
request.encode_ui32(0);
|
||||
request.encode_ui32(0);
|
||||
|
||||
const response = await conn.send(
|
||||
'::RemoteFUSEGetattr',
|
||||
request,
|
||||
optional_thread_id
|
||||
);
|
||||
response.decode_ui32(); // Service flags
|
||||
|
||||
const result = response.decode_i32();
|
||||
if (result === 0) {
|
||||
return response.decode_stat();
|
||||
}
|
||||
|
||||
return Promise.reject(
|
||||
new Error(`'get_file_attributes2' failed: ${result}`)
|
||||
);
|
||||
} catch (err) {
|
||||
return Promise.reject(new Error(`'get_file_attributes2' failed: ${err}`));
|
||||
}
|
||||
};
|
||||
|
||||
export const list_directory = async (conn, remote_path, page_reader_cb) => {
|
||||
const dir_snapshot = await _snapshot_directory(conn, remote_path);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user