{"id":24096030,"url":"https://github.com/becodeorg/pijon","last_synced_at":"2026-06-03T23:31:14.841Z","repository":{"id":35650519,"uuid":"197897706","full_name":"becodeorg/pijon","owner":"becodeorg","description":"⚙️ Pijon, the delivery man - File upload lambda preparator","archived":false,"fork":false,"pushed_at":"2023-01-23T23:43:04.000Z","size":5455,"stargazers_count":0,"open_issues_count":32,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-01-10T12:09:08.819Z","etag":null,"topics":["internal-tool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/becodeorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-20T07:47:43.000Z","updated_at":"2021-06-22T09:36:01.000Z","dependencies_parsed_at":"2023-02-13T04:50:59.967Z","dependency_job_id":null,"html_url":"https://github.com/becodeorg/pijon","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becodeorg%2Fpijon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becodeorg%2Fpijon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becodeorg%2Fpijon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/becodeorg%2Fpijon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/becodeorg","download_url":"https://codeload.github.com/becodeorg/pijon/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241018899,"owners_count":19895167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["internal-tool"],"created_at":"2025-01-10T12:09:38.757Z","updated_at":"2026-06-03T23:31:14.801Z","avatar_url":"https://github.com/becodeorg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BeCode: pijon\n\n\u003e ⚙️ Pijon, the delivery man - File upload lambda preparator\n\n* * *\n\n## About\n\nUploading file from a SPA needs a server to handling file.  \nBut what to do when you are working on a _static_ SPA?\n\n**pijon** is a lambda serverless function, preparing requests for uploading files to AWS S3 bucket.\n\nCalling **pijon** with a *file name* and a *mime type*, it will generates two URLs: the first is your *endpoint* to upload the file to your S3 bucket, and the second will be the final public URL of your file when the upload is done.\n\n## Installation\n\nFirstly, run the classic `npm install` to install dependencies.\n\nYou will also need to create the file `env/sls.env.json`, following this structure:\n\n```json\n{\n\t\"dev\": {\n\t\t\"SERVICE_XXXXXXXXXXXX_BUCKET\": \"my-s3-bucket-name\",\n\t\t\"SERVICE_XXXXXXXXXXXX_ORIGIN\": \"www.my-site.me,api.my-site.me\"\n\t}\n}\n```\n\nThe `XXXXXXXXXXXX` in the keys are your *pijon service id*, that will be used to know to which bucket send files, and verify the origin of the request.\n\n## Usage\n\nSimply call the URL on of the lambda with `POST` request with three properties:\n\n- `service`: your *pijon service id* as explained\n- `name`: the name of the file that will be uploaded\n- `type`: the *mime type* of the file that will be uploaded\n- `acl`: the *ACL* to applied to the upload (defaults to `\"public-read\"`).\n\nThe call will respond a `json object` with following properties:\n\n- `bucket`: the name of the bucket on which the file is stored\n- `key`: the key of the file on the bucket\n- `region`: the region where the bucket is stored\n- `uploadUrl`: the URL to make a `PUT` request to with your file\n- `objectUrl`: the final, public URL of your file on your S3 bucket, after the upload is done\n\n\u003e ⚠️ when you upload your file to the `uploadUrl`, don't forget to add a `Content-Type` header to your request, matching the *mime type* of your file! \n\n### Development\n\nRun `npm run build` to build the code.\n\n#### Deployment\n\nYou need to have [setup](https://serverless.com/framework/docs/providers/aws/guide/credentials/) the appropriate user from AWS and stored it in your `~/.aws/credentials`.\n\n##### Dev deployment\n\n\tnpm run deploy:dev --aws-profile=\u003cyour-aws-profile\u003e\n\n##### Production deployment\n\n\tnpm run deploy:prod --aws-profile=\u003cyour-aws-profile\u003e\n\n* * *\n\nJuly 2019, leny.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecodeorg%2Fpijon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbecodeorg%2Fpijon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbecodeorg%2Fpijon/lists"}