-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
43 lines (28 loc) · 773 Bytes
/
index.js
File metadata and controls
43 lines (28 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const gpgfs = require('./src/index')
async function main(){
const securefs = new gpgfs()
await securefs.open()
//! Trust user
await securefs.keychain.trustCard()
const bucket = await securefs.bucket('staging')
if(!bucket.exists()){
console.log('creating bucket')
await bucket.create()
}
console.log(bucket)
const file = await bucket.file('directory-1/foo/bar/filet-test.txt')
if(!file.exists()){
console.log('creating file')
await file.create()
await file.save('hello world')
}
const content = await file.read()
const metadata = await file.getMetadata()
console.log('file-content [', content, ']')
}
// Run main
main().catch((error) => {
console.log(error)
console.error(error.message)
process.exit()
})