mobiletto 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -38,8 +38,8 @@ Today the supported drivers are:
38
38
  const s3 = await mobiletto('s3', aws_key, aws_secret, {bucket: 'bk', region: 'us-east-1'})
39
39
 
40
40
  // List files
41
- local.list() // --> returns an array of file objects
42
- s3.list() // --> returns an array of file objects
41
+ local.list() // --> returns an array of metadata objects
42
+ s3.list() // --> returns an array of metadata objects
43
43
 
44
44
  // List files recursively
45
45
  local.list({ recursive: true })
@@ -59,8 +59,8 @@ Today the supported drivers are:
59
59
  s3.safeList('/path/that/does/not/exist') // returns []
60
60
 
61
61
  // Read metadata for a file
62
- local.metadata(path)
63
- s3.metadata(path)
62
+ local.metadata(path) // returns metadata object
63
+ s3.metadata(path) // returns metadata object
64
64
 
65
65
  // The `metadata` method throws MobilettoNotFoundError if the path does not exist
66
66
  // When you call `safeMetadata` on a non-existent path, it returns null
@@ -69,12 +69,12 @@ Today the supported drivers are:
69
69
  // Read a file
70
70
  // Provide a callback that writes the data someplace
71
71
  const callback = (chunk) => { ... write chunk somewhere ... }
72
- local.read(path, callback)
73
- s3.read(path, callback)
72
+ local.read(path, callback) // returns count of bytes read
73
+ s3.read(path, callback) // returns count of bytes read
74
74
 
75
75
  // Read an entire file at once (convenience method)
76
76
  const localData = await local.readFile(path) // returns a byte Buffer of the file contents
77
- const s3Data = await s3.readFile(path) // returns a byte Buffer of the file contents
77
+ const s3Data = await s3.readFile(path) // returns a byte Buffer of the file contents
78
78
 
79
79
  // Write a file
80
80
  // Provide a generator function that yields chunks of data
@@ -84,18 +84,18 @@ Today the supported drivers are:
84
84
  yield data
85
85
  }
86
86
  }
87
- local.write(path, generator)
88
- s3.write(path, generator)
87
+ local.write(path, generator) // returns count of bytes written
88
+ s3.write(path, generator) // returns count of bytes written
89
89
 
90
90
  // Write an entire file at once (convenience method)
91
- await local.writeFile(path, bufferOrString) // returns count of bytes written
91
+ await local.writeFile(path, bufferOrString) // returns count of bytes written
92
92
  await s3.writeFile(path, bufferOrString) // returns count of bytes written
93
93
 
94
94
  // Delete a file
95
95
  // Quiet param is optional (default false), when set errors will not be thrown if the path does not exist
96
96
  const quiet = true
97
- local.remove(path, {quiet})
98
- s3.remove(path, {quiet})
97
+ local.remove(path, {quiet}) // returns true upon success
98
+ s3.remove(path, {quiet}) // returns true upon success
99
99
 
100
100
  // Recursively delete a directory and do it quietly (do not report errors)
101
101
  const recursive = true
@@ -120,7 +120,7 @@ A metadata object looks like this:
120
120
  The `type` property can be `file`, `dir`, `link`, or `special`.
121
121
 
122
122
  Depending on the type of driver, a `list` command may not return all fields. The `name` and `type` properties
123
- should always be present. A subsequent `metadata` command should return all available properties.
123
+ should always be present. A subsequent `metadata` command will return all available properties.
124
124
 
125
125
  # Alternate import style
126
126
  Import the fully-scoped module and use the `connect` function:
@@ -231,8 +231,8 @@ The object that the storageClient function returns must define these functions:
231
231
  async read (path, callback, endCallback = null)
232
232
 
233
233
  // Write a file
234
- // readFunc returns the data you want to write
235
- async write (path, readFunc)
234
+ // driver must be able to handle a generator or a stream
235
+ async write (path, generatorOrReadableStream)
236
236
 
237
237
  // Remove a file, or recursively delete a directory
238
238
  async remove (path, recursive = false, quiet = false)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobiletto",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "A storage abstraction layer",
5
5
  "main": "index.js",
6
6
  "author": "Jonathan Cobb",