Skip to content

Commit

Permalink
Merge pull request #1 from MakerXStudio/fix-file-system-put-binary
Browse files Browse the repository at this point in the history
Fix FileSystemObjectCache.putBinary
  • Loading branch information
robdmoore authored Apr 23, 2024
2 parents 9509b0e + af1e7ee commit 5cbe4c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"source.fixAll.eslint": "explicit"
},
"jest.outputConfig": { "revealWithFocus": "none" },
"jest.autoRun": {
"watch": false,
"onSave": "test-file",
"onStartup": false
"jest.runMode": {
"type": "on-save"
}
}
6 changes: 2 additions & 4 deletions src/fileSystemObjectCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class FileSystemObjectCache implements ObjectCache {
/** Adds the given value to the cache for the given cache key
* @param cacheKey A unique key that identifies the cached value
* @param data The data to cache
* @param mimeType Optional mime type of the data; default = `application/json` or `application/octet-stream` depending on if the data is binary or JSON.
*/
async put<T>(cacheKey: string, data: T): Promise<void> {
const cachePath = path.join(this.cacheDirectory, data instanceof Uint8Array ? cacheKey : `${cacheKey}.json`)
Expand Down Expand Up @@ -140,9 +139,8 @@ export class FileSystemObjectCache implements ObjectCache {
/** Adds the given binary value to the cache for the given cache key
* @param cacheKey A unique key that identifies the cached value
* @param data The binary data to cache
* @param mimeType Optional mime type of the data; default = `application/json` or `application/octet-stream` depending on if the data is binary or JSON.
*/
putBinary(cacheKey: string, data: Uint8Array, mimeType?: string): Promise<void> {
return this.putBinary(cacheKey, data, mimeType)
putBinary(cacheKey: string, data: Uint8Array): Promise<void> {
return this.put(cacheKey, data)
}
}

0 comments on commit 5cbe4c1

Please sign in to comment.