
Product
Socket Brings Supply Chain Security to skills.sh
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.
@frankhoodbs/aws-media-helper
Advanced tools
This utility provides methods used to perform aws media uploads correctly.
This utility provides methods used to perform aws media uploads correctly.
in order to obtain an AWSInfoObject its necessary to call an API service that will change based on the backend of the project. The said API must be ready to respond with the following standard structure.
interface AWSInfoObject {
link: string;
data: AWSData;
}
interface AWSData {
acl: string;
'Content-Type': string;
key: string;
'x-amz-algorithm': string;
'x-amz-credential': string;
'x-amz-date': string;
policy: string;
'x-amz-signature': string;
}
http GET request to you server to get the AWSInfoObjectgetAwsUploadUrlAndPayload from this utilty to get the {url,payload} objectPOST request using the given url and payloadextractAwsLocationenv_template.json file and rename it as env.jsonHTTP GET request to get your AWSInfoObject (you need those credentials first)env.json file/aws-media-helper/node-server folder with the command node server.jsnvm use then yarn and finally yarn devportgenerate IMAGE (will be randomly selected from a lorem picsum pool)Send to aws403 error means the credentials are expired)The location link needs the signature to view the image directly from the AWS bucket, since those buckets are private.
getAwsUploadUrlAndPayload(AWSInfoObject: AWSInfoObject, base64:string)Builds the payload for AWS and gives back said payload, and the url to execute the POST request
AWSInfoObject): The object containig all the AWS info, given from the server.string): The Base64 value rapresenting an image.JSON Object): JSON object with url and payload propertiesextractAwsLocation(AWSResponseObject)Extract the aws location URL from the aws response object.
any): the object retrieved from the aws responsestring): signed URL that points to the media stored o the aws service.getImageFormatFromBase64(base64: string)extract image format from base64 string.
string): The Base64 value rapresenting an image.string): string rapresenting image format.buildAwsFormdata(base64: string, AWSInfoObject: AWSInfoObject, imagetype: string)builds the FormData object for the aws upload.
string): The Base64 value rapresenting an image.AWSInfoObject): The object containig all the AWS info, given from the server.string): image format.FormData): FormData object to be sent as payload to aws.async function sendToAWS() {
let AwsInfo: AWSInfoObject = {...};
let AWSLocation, errorCode;
// GET your credential from the server
const urltoGetConfig = new URL("http://localhost:5000/aws")
AwsInfo = await fetch(urltoGetConfig).then(response => response.json());
console.log('AwsInfo - object retrieved from configuration',AwsInfo)
// Generate payload and url
const AWSUrlAdPayload = getAwsUploadUrlAndPayload(AwsInfo, foo.value.imageB64);
// do the POST request to AWS
const AWSResponse = await fetch(AWSUrlAdPayload.url, { method: 'post', body: AWSUrlAdPayload.payload });
console.log('AWSResponse', AWSResponse)
// Handle response as you need
if (AWSResponse.ok) {
// extract location
AWSLocation = extractAwsLocation(AWSResponse)
} else {
errorCode = AWSResponse.status;
}
}


FAQs
This utility provides methods used to perform aws media uploads correctly.
We found that @frankhoodbs/aws-media-helper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.

Product
Socket now supports PHP with full Composer and Packagist integration, enabling developers to search packages, generate SBOMs, and protect their PHP dependencies from supply chain threats.

Security News
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.