Skip to content

Commit

Permalink
Merge pull request #73 from AlexanderYW/v5-feature/implemented-stats
Browse files Browse the repository at this point in the history
Implemented get blob stats api
  • Loading branch information
AlexanderYW committed Oct 12, 2021
2 parents 77d81f5 + 662a9e4 commit e7946ba
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Drivers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,22 @@ export class AzureStorageDriver implements AzureStorageDriverContract {
throw CannotMoveFileException.invoke(source, destination, error.original || error)
}
}

/**
* Returns the file stats
*/
public async getStats(location: string): Promise<DriveFileStats> {
try {
const metaData = await this.getBlockBlobClient(location).getProperties()

return {
modified: metaData.lastModified!,
size: metaData.contentLength!,
isFile: true,
etag: metaData.etag,
}
} catch (error) {
throw CannotGetMetaDataException.invoke(location, 'stats', error)
}
}
}

0 comments on commit e7946ba

Please sign in to comment.