### Install Dependencies with npm Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/nodejs/README.md Run this command in your terminal to install the necessary project dependencies. ```bash npm install ``` -------------------------------- ### API Response Example Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/nodejs/README.md This JSON object shows the structure of a successful API response, containing presigned URLs for both GET and PUT operations. ```json { "get-url": "https://bucket.s3.bitiful.net/tmp/test?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...", "put-url": "https://bucket.s3.bitiful.net/tmp/test?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=..." } ``` -------------------------------- ### Example Request URL for Presigned URL Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/nodejs/README.md This is an example of a request URL to the API server. It includes the object key and a content-length limit. ```http http://127.0.0.1:1998/presigned-url?key=tmp/test&content-length=231703 ``` -------------------------------- ### Start the S3 Presigned API Server Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/nodejs/README.md Start the server using Node.js, providing your S3 bucket name and AWS credentials as environment variables. The server defaults to port 1998. ```bash BUCKET= AK= SK= node app.js ``` -------------------------------- ### Basic GET Request for Presigned URL Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/README.md Use this basic GET request to obtain a presigned URL for an object. Ensure the 'key' parameter is provided. ```http GET /presigned-url?key=images/photo.jpg ``` -------------------------------- ### S3 Presigned URL API Response Example Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/README.md This JSON structure represents a successful response from the S3 Presigned URL API, providing URLs for both GET and PUT operations. ```json { "get-url": "https://s3.bitiful.net/fanfan/example.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...", "put-url": "https://s3.bitiful.net/fanfan/example.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=..." } ``` -------------------------------- ### GET Request with Simul-Transfer and Force Download Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/README.md Enable 'simul-transfer' with 'no-wait' and force downloads using 'force-download=true'. 'no-wait' specifies the timeout in seconds for the simul-transfer feature. ```http GET /presigned-url?key=videos/movie.mp4&no-wait=5&force-download=true ``` -------------------------------- ### GET Request with Max Downloads and Rate Limit Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/README.md Limit the number of download requests and set a transfer rate limit using 'max-requests' and 'limit-rate'. 'limit-rate' is in bytes per second. ```http GET /presigned-url?key=archives/backup.zip&max-requests=3&limit-rate=1048576 ``` -------------------------------- ### GET Request with Content Length and Expiration Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/README.md Specify content length and expiration time for the presigned URL. The 'content-length' is for upload size, and 'expire' sets the URL's validity in seconds. ```http GET /presigned-url?key=documents/report.pdf&content-length=1048576&expire=7200 ``` -------------------------------- ### Generate Presigned URL Source: https://github.com/bitiful/s3-presigned-api-server/blob/main/nodejs/README.md This endpoint generates presigned URLs for S3 GET and PUT operations. It supports various optional parameters to customize the URL, such as content length, expiration time, and download limits. ```APIDOC ## GET /presigned-url ### Description Generates presigned URLs for S3 GET and PUT operations with support for custom parameters. ### Method GET ### Endpoint `/presigned-url` ### Parameters #### Query Parameters - **key** (string) - Required - The object key name. - **content-length** (number) - Optional - Content length limit. - **no-wait** (number) - Optional - Immediate receive timeout in seconds. - **max-requests** (number) - Optional - Maximum download attempts. - **expire** (number) - Optional - Link validity period in seconds. - **force-download** (boolean) - Optional - Force download, set to `true`. - **limit-rate** (number) - Optional - Single-thread rate limiting. ### Request Example ``` http://127.0.0.1:1998/presigned-url?key=tmp/test&content-length=231703 ``` ### Response #### Success Response (200) - **get-url** (string) - The presigned URL for GET requests. - **put-url** (string) - The presigned URL for PUT requests. #### Response Example ```json { "get-url": "https://bucket.s3.bitiful.net/tmp/test?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...", "put-url": "https://bucket.s3.bitiful.net/tmp/test?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=..." } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.