added prettier

This commit is contained in:
2021-03-10 21:32:11 -06:00
parent 883e7a7f62
commit d39e087406
15 changed files with 885 additions and 548 deletions

View File

@@ -1,7 +1,7 @@
import file from './io/file'
import file from './io/file';
import connection from './networking/connection';
import connection_pool from './networking/connection_pool';
import * as ops from './ops'
import * as ops from './ops';
export const connect = async (host_or_ip, port, password) => {
const conn = new connection(host_or_ip, port, password);
@@ -9,33 +9,53 @@ export const connect = async (host_or_ip, port, password) => {
return conn;
};
export const create_api = conn => {
export const create_api = (conn) => {
return {
directory : {
create: async remote_path => ops.create_directory(conn, remote_path),
directory: {
create: async (remote_path) => ops.create_directory(conn, remote_path),
list: async (remote_path, page_reader_cb) =>
ops.list_directory(conn, remote_path, page_reader_cb),
remove: async remote_path => ops.remove_directory(conn, remote_path),
snapshot: async remote_path => {
remove: async (remote_path) => ops.remove_directory(conn, remote_path),
snapshot: async (remote_path) => {
return ops.snapshot_directory(conn, remote_path);
},
},
file : {
create_or_open : async remote_path => new file(
conn, await ops.create_or_open_file(conn, remote_path), remote_path),
delete : async (remote_path) => ops.delete_file(conn, remote_path),
download :
async (remote_path, local_path, progress_cb, overwrite, resume) =>
ops.download_file(conn, remote_path, local_path, progress_cb,
overwrite, resume),
open : async remote_path =>
new file(conn, await ops.open_file(conn, remote_path), remote_path),
upload :
async (local_path, remote_path, progress_cb, overwrite, resume) =>
ops.upload_file(conn, local_path, remote_path, progress_cb,
overwrite, resume),
file: {
create_or_open: async (remote_path) =>
new file(
conn,
await ops.create_or_open_file(conn, remote_path),
remote_path
),
delete: async (remote_path) => ops.delete_file(conn, remote_path),
download: async (
remote_path,
local_path,
progress_cb,
overwrite,
resume
) =>
ops.download_file(
conn,
remote_path,
local_path,
progress_cb,
overwrite,
resume
),
open: async (remote_path) =>
new file(conn, await ops.open_file(conn, remote_path), remote_path),
upload: async (local_path, remote_path, progress_cb, overwrite, resume) =>
ops.upload_file(
conn,
local_path,
remote_path,
progress_cb,
overwrite,
resume
),
},
get_drive_information : async () => ops.get_drive_information(conn),
get_drive_information: async () => ops.get_drive_information(conn),
};
};