mobiletto 1.0.17 → 1.0.18

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 (3) hide show
  1. package/README.md +9 -1
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ Mobiletto is a JavaScript storage abstraction layer, with optional transparent c
5
5
 
6
6
  It supports apps that are agnostic to where files are stored.
7
7
 
8
- All drivers are tested for identical behavior with over 35 tests for each driver.
8
+ All drivers are tested for identical behavior with over 40 tests for each driver.
9
9
 
10
10
  Today the supported drivers are:
11
11
 
@@ -53,10 +53,18 @@ Today the supported drivers are:
53
53
  // Visit files in a directory -- visitor function must be async
54
54
  local.list(path, { visitor: myAsyncFunc })
55
55
  s3.list(path, { visitor: myAsyncFunc, recursive: true })
56
+
57
+ // The `list` method throws MobilettoNotFoundError if the path does not exist
58
+ // When you call `safeList` on a non-existent path, it returns an empty array
59
+ s3.safeList('/path/that/does/not/exist') // returns []
56
60
 
57
61
  // Read metadata for a file
58
62
  local.metadata(path)
59
63
  s3.metadata(path)
64
+
65
+ // The `metadata` method throws MobilettoNotFoundError if the path does not exist
66
+ // When you call `safeMetadata` on a non-existent path, it returns null
67
+ local.safeMetadata('/tmp/does_not_exist') // returns null
60
68
 
61
69
  // Read a file
62
70
  // Provide a callback that writes the data someplace
package/index.js CHANGED
@@ -81,7 +81,7 @@ const UTILITY_FUNCTIONS = {
81
81
  },
82
82
  safeMetadata: (client) => async (path) => {
83
83
  try {
84
- return await client.driver_metadata(path)
84
+ return await client.metadata(path)
85
85
  } catch (e) {
86
86
  if (e instanceof MobilettoNotFoundError) {
87
87
  return null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobiletto",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "A storage abstraction layer",
5
5
  "main": "index.js",
6
6
  "author": "Jonathan Cobb",