renamed 'delete' to 'remove'
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
## 1.3.3-r1
|
## 1.3.3-r1
|
||||||
- Support writing base64 string data
|
- Support writing base64 string data
|
||||||
- Allow external ChaCha20 encryption/decryption
|
- Allow external ChaCha20 encryption/decryption
|
||||||
|
- Renamed 'delete/delete_file' to 'remove/remove_file'
|
||||||
|
|
||||||
## 1.3.1-r3
|
## 1.3.1-r3
|
||||||
- Added directory/file exists
|
- Added directory/file exists
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ test('can get directory list and snapshot using api', async () => {
|
|||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can create, close and delete a file using api', async () => {
|
test('can create, close and remove a file using api', async () => {
|
||||||
const conn = await repertory.create_pool(
|
const conn = await repertory.create_pool(
|
||||||
2,
|
2,
|
||||||
TEST_HOST,
|
TEST_HOST,
|
||||||
@@ -169,12 +169,12 @@ test('can create, close and delete a file using api', async () => {
|
|||||||
expect(await f.close()).toEqual(0);
|
expect(await f.close()).toEqual(0);
|
||||||
expect(f.handle).toBeNull();
|
expect(f.handle).toBeNull();
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_file.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_file.dat')).toEqual(0);
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('can open, close and delete a file using api', async () => {
|
test('can open, close and remove a file using api', async () => {
|
||||||
const conn = await repertory.create_pool(
|
const conn = await repertory.create_pool(
|
||||||
2,
|
2,
|
||||||
TEST_HOST,
|
TEST_HOST,
|
||||||
@@ -194,7 +194,7 @@ test('can open, close and delete a file using api', async () => {
|
|||||||
expect(await f.close()).toEqual(0);
|
expect(await f.close()).toEqual(0);
|
||||||
expect(f.handle).toBeNull();
|
expect(f.handle).toBeNull();
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_file.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_file.dat')).toEqual(0);
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
});
|
});
|
||||||
@@ -221,7 +221,7 @@ test('can write to and read from a file using api', async () => {
|
|||||||
expect(buffer.compare(buffer2)).toEqual(0);
|
expect(buffer.compare(buffer2)).toEqual(0);
|
||||||
|
|
||||||
expect(await f.close()).toEqual(0);
|
expect(await f.close()).toEqual(0);
|
||||||
expect(await api.file.delete('/repertory_file.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_file.dat')).toEqual(0);
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
});
|
});
|
||||||
@@ -243,7 +243,7 @@ test('can truncate a file using api', async () => {
|
|||||||
expect(new Uint64BE(await f.get_size()).toNumber()).toEqual(0);
|
expect(new Uint64BE(await f.get_size()).toNumber()).toEqual(0);
|
||||||
|
|
||||||
expect(await f.close()).toEqual(0);
|
expect(await f.close()).toEqual(0);
|
||||||
expect(await api.file.delete('/repertory_file.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_file.dat')).toEqual(0);
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
});
|
});
|
||||||
@@ -282,7 +282,7 @@ test('can upload and download a file using api', async () => {
|
|||||||
|
|
||||||
expect(await api.directory.exists('/repertory_test.dat')).toEqual(false);
|
expect(await api.directory.exists('/repertory_test.dat')).toEqual(false);
|
||||||
expect(await api.file.exists('/repertory_test.dat')).toEqual(true);
|
expect(await api.file.exists('/repertory_test.dat')).toEqual(true);
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
fs.unlinkSync('repertory_test.dat');
|
fs.unlinkSync('repertory_test.dat');
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
@@ -323,7 +323,7 @@ test('can download and overwrite a file using api', async () => {
|
|||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
fs.unlinkSync('repertory_test.dat');
|
fs.unlinkSync('repertory_test.dat');
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
@@ -364,7 +364,7 @@ test('download fails if overwrite is false using api', async () => {
|
|||||||
)
|
)
|
||||||
).rejects.toThrow(Error);
|
).rejects.toThrow(Error);
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
fs.unlinkSync('repertory_test.dat');
|
fs.unlinkSync('repertory_test.dat');
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
@@ -395,7 +395,7 @@ test('can upload and overwrite a file using api', async () => {
|
|||||||
)
|
)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
}, 60000);
|
}, 60000);
|
||||||
@@ -425,7 +425,7 @@ test('upload fails if overwrite is false using api', async () => {
|
|||||||
)
|
)
|
||||||
).rejects.toThrow(Error);
|
).rejects.toThrow(Error);
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
}, 60000);
|
}, 60000);
|
||||||
@@ -467,7 +467,7 @@ test('can resume download using api', async () => {
|
|||||||
await calculate_sha256('repertory_test.dat')
|
await calculate_sha256('repertory_test.dat')
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
fs.unlinkSync('repertory_test.dat');
|
fs.unlinkSync('repertory_test.dat');
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
@@ -517,7 +517,7 @@ test('can resume upload using api', async () => {
|
|||||||
await calculate_sha256('repertory_test.dat')
|
await calculate_sha256('repertory_test.dat')
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(await api.file.delete('/repertory_test.dat')).toEqual(0);
|
expect(await api.file.remove('/repertory_test.dat')).toEqual(0);
|
||||||
fs.unlinkSync('repertory_test.dat');
|
fs.unlinkSync('repertory_test.dat');
|
||||||
|
|
||||||
await conn.disconnect();
|
await conn.disconnect();
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export const create_api = (conn) => {
|
|||||||
await ops.create_or_open_file(conn, remote_path),
|
await ops.create_or_open_file(conn, remote_path),
|
||||||
remote_path
|
remote_path
|
||||||
),
|
),
|
||||||
delete: async (remote_path) => ops.delete_file(conn, remote_path),
|
|
||||||
download: async (
|
download: async (
|
||||||
remote_path,
|
remote_path,
|
||||||
local_path,
|
local_path,
|
||||||
@@ -71,6 +70,7 @@ export const create_api = (conn) => {
|
|||||||
},
|
},
|
||||||
open: async (remote_path) =>
|
open: async (remote_path) =>
|
||||||
new file(conn, await ops.open_file(conn, remote_path), remote_path),
|
new file(conn, await ops.open_file(conn, remote_path), remote_path),
|
||||||
|
remove: async (remote_path) => ops.remove_file(conn, remote_path),
|
||||||
upload: async (local_path, remote_path, progress_cb, overwrite, resume) =>
|
upload: async (local_path, remote_path, progress_cb, overwrite, resume) =>
|
||||||
ops.upload_file(
|
ops.upload_file(
|
||||||
conn,
|
conn,
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ export const create_or_open_file = async (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const delete_file = async (conn, remote_path) => {
|
export const remove_file = async (conn, remote_path) => {
|
||||||
try {
|
try {
|
||||||
const request = new packet();
|
const request = new packet();
|
||||||
request.encode_utf8(remote_path);
|
request.encode_utf8(remote_path);
|
||||||
@@ -149,7 +149,7 @@ export const delete_file = async (conn, remote_path) => {
|
|||||||
|
|
||||||
return response.decode_i32();
|
return response.decode_i32();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return Promise.reject(new Error(`'delete_file' failed: ${err}`));
|
return Promise.reject(new Error(`'remove_file' failed: ${err}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user