'Node.js Override a class function of a module
How can I override the upload method of the S3 class that I import from the "aws-sdk" module in all the project file?
import {S3} from "aws-sdk";
const s3 = new S3({
region: "us-east-1"
});
s3.upload({
Bucket: "bucket",
Key: "file",
Body: "content",
ACL: "private"
});
Solution 1:[1]
I figured it out
S3.prototype.upload = (params: S3.Types.PutObjectRequest, options?: ManagedUpload.ManagedUploadOptions) => {
// Custom
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | nullException |
