Sign inSign up

testimio/local-file-storage

By testimio

•Updated almost 2 years ago
Archived

Used for testing upload file actions

Image
0

1.3K

testimio/local-file-storage repository overview

⁠🏬 Testim IO local storage

⁠👷‍♀️ Setup

run:

npm i
npm start

The server is accessible through http://localhost:5600⁠

⁠🤾‍♀️ Interactions

⁠Uploading a file

In case you want to upload a file you can send a post request, with the header Content-Type: multipart/form-data.

The payload needs to look like this:


{
    "food": "pizza",
    "toppings": {
        "all": ["pineapple", "cheese"],
        "leftHalf":  ["Mushrooms"],
        "rightHalf": ["Fetta cheese"]
    },
    "notes": ["Don't burn it this time"],
    "pizzaPicture": FileBlobOfThePicture,
    "invoicePDF": PDFOfInvoice
}

You'll get in return the next data:

{
    "food": "pizza",
    "toppings": {
        "all": ["pineapple", "cheese"],
        "leftHalf":  ["Mushrooms"],
        "rightHalf": ["Fetta cheese"]
    },
    "notes": ["Don't burn it this time"],
    "pizzaPicture": "pizzaPicture-1826498.png",
    "invoicePDF": "invoicePdf-1826500.pdf"
}
⁠📁 Acquiring a file

After you uploaded the file you can go to http://localhost:5600/<filenameFromResponse>. Based on our example you can go to http://localhost:5600/invoicePdf-1826500.pdf to see that the payload you send is incorrect.

⁠🐳 Docker and stuff

First, build the docker image:

docker pull testimio/local-file-storage
docker run -dp 5600:5600 local-file-storage

To access the server over a different port, like 3020:

docker run -dp 3020:5600 testimio/local-file-storage

and then the server will be available via http://localhost:3020

Tag summary

Content type

Image

Digest

sha256:d111c2c80…

Size

70.3 MB

Last updated

almost 2 years ago

docker pull testimio/local-file-storage