fix(metadata): Fix metadata handling to address type assertion and data retrieval.
This commit is contained in:
parent
7db4d24817
commit
e7f60465ff
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-11-18 - 3.0.24 - fix(metadata)
|
||||
Fix metadata handling to address type assertion and data retrieval.
|
||||
|
||||
- Fixed type assertion issues in `MetaData` class properties with type non-null assertions.
|
||||
- Corrected the handling of JSON data retrieval in `MetaData.storeCustomMetaData` function.
|
||||
|
||||
## 2024-10-16 - 3.0.23 - fix(dependencies)
|
||||
Update package dependencies for improved functionality and security.
|
||||
|
||||
|
11293
pnpm-lock.yaml
generated
11293
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -21,4 +21,8 @@ tap.test('should create a valid smartbucket', async () => {
|
||||
expect(myBucket.name).toEqual('testzone');
|
||||
});
|
||||
|
||||
tap.test('', async () => {
|
||||
|
||||
})
|
||||
|
||||
export default tap.start();
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartbucket',
|
||||
version: '3.0.23',
|
||||
version: '3.0.24',
|
||||
description: 'A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.'
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ export class MetaData {
|
||||
/**
|
||||
* the file that contains the metadata
|
||||
*/
|
||||
metadataFile: File;
|
||||
metadataFile!: File;
|
||||
|
||||
/**
|
||||
* the file that the metadata is for
|
||||
*/
|
||||
fileRef: File;
|
||||
fileRef!: File;
|
||||
|
||||
public async getFileType(optionsArg?: {
|
||||
useFileExtension?: boolean;
|
||||
@ -44,13 +44,13 @@ export class MetaData {
|
||||
const stat = await this.fileRef.parentDirectoryRef.bucketRef.fastStat({
|
||||
path: this.fileRef.getBasePath(),
|
||||
});
|
||||
return stat.ContentLength;
|
||||
return stat.ContentLength!;
|
||||
}
|
||||
|
||||
private prefixCustomMetaData = 'custom_';
|
||||
|
||||
public async storeCustomMetaData<T = any>(optionsArg: { key: string; value: T }) {
|
||||
const data = await this.metadataFile.getContentsAsString();
|
||||
const data = await this.metadataFile.getJsonData();
|
||||
data[this.prefixCustomMetaData + optionsArg.key] = optionsArg.value;
|
||||
await this.metadataFile.writeJsonData(data);
|
||||
}
|
||||
|
@ -6,7 +6,8 @@
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"strict": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
|
Loading…
Reference in New Issue
Block a user