[{"data":1,"prerenderedAt":680},["ShallowReactive",2],{"navigation":3,"-drivers-s3":137,"-drivers-s3-surround":675},[4,26],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Getting Started","\u002Fguide","1.guide\u002F1.index",[9,11,16,21],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Utilities","\u002Fguide\u002Futils","1.guide\u002F2.utils","et:tools-2",{"title":17,"path":18,"stem":19,"icon":20},"HTTP Server","\u002Fguide\u002Fhttp-server","1.guide\u002F3.http-server","ic:baseline-http",{"title":22,"path":23,"stem":24,"icon":25},"Custom Driver","\u002Fguide\u002Fcustom-driver","1.guide\u002F4.custom-driver","carbon:area-custom",{"title":27,"path":28,"stem":29,"children":30,"icon":32},"Drivers","\u002Fdrivers","2.drivers\u002F0.index",[31,33,38,43,48,53,58,63,68,73,77,82,87,92,97,102,107,112,117,122,127,132],{"title":27,"path":28,"stem":29,"icon":32},"icon-park-outline:hard-disk",{"title":34,"path":35,"stem":36,"icon":37},"Azure","\u002Fdrivers\u002Fazure","2.drivers\u002Fazure","mdi:microsoft-azure",{"title":39,"path":40,"stem":41,"icon":42},"Browser","\u002Fdrivers\u002Fbrowser","2.drivers\u002Fbrowser","ph:browser-thin",{"title":44,"path":45,"stem":46,"icon":47},"Capacitor Preferences","\u002Fdrivers\u002Fcapacitor-preferences","2.drivers\u002Fcapacitor-preferences","nonicons:capacitor-16",{"title":49,"path":50,"stem":51,"icon":52},"Cloudflare","\u002Fdrivers\u002Fcloudflare","2.drivers\u002Fcloudflare","devicon-plain:cloudflareworkers",{"title":54,"path":55,"stem":56,"icon":57},"SQL Database","\u002Fdrivers\u002Fdatabase","2.drivers\u002Fdatabase","ph:database",{"title":59,"path":60,"stem":61,"icon":62},"Deno KV","\u002Fdrivers\u002Fdeno","2.drivers\u002Fdeno","simple-icons:deno",{"title":64,"path":65,"stem":66,"icon":67},"Filesystem (Node.js)","\u002Fdrivers\u002Ffs","2.drivers\u002Ffs","ph:file-light",{"title":69,"path":70,"stem":71,"icon":72},"GitHub","\u002Fdrivers\u002Fgithub","2.drivers\u002Fgithub","mdi:github",{"title":74,"path":75,"stem":76,"icon":20},"HTTP","\u002Fdrivers\u002Fhttp","2.drivers\u002Fhttp",{"title":78,"path":79,"stem":80,"icon":81},"LRU Cache","\u002Fdrivers\u002Flru-cache","2.drivers\u002Flru-cache","material-symbols:cached-rounded",{"title":83,"path":84,"stem":85,"icon":86},"Memory","\u002Fdrivers\u002Fmemory","2.drivers\u002Fmemory","bi:memory",{"title":88,"path":89,"stem":90,"icon":91},"MongoDB","\u002Fdrivers\u002Fmongodb","2.drivers\u002Fmongodb","teenyicons:mongodb-outline",{"title":93,"path":94,"stem":95,"icon":96},"Netlify Blobs","\u002Fdrivers\u002Fnetlify","2.drivers\u002Fnetlify","teenyicons:netlify-solid",{"title":98,"path":99,"stem":100,"icon":101},"Null","\u002Fdrivers\u002Fnull","2.drivers\u002Fnull","bi:trash3-fill",{"title":103,"path":104,"stem":105,"icon":106},"Overlay","\u002Fdrivers\u002Foverlay","2.drivers\u002Foverlay","carbon:overlay",{"title":108,"path":109,"stem":110,"icon":111},"PlanetScale","\u002Fdrivers\u002Fplanetscale","2.drivers\u002Fplanetscale","simple-icons:planetscale",{"title":113,"path":114,"stem":115,"icon":116},"Redis","\u002Fdrivers\u002Fredis","2.drivers\u002Fredis","simple-icons:redis",{"title":118,"path":119,"stem":120,"icon":121},"S3","\u002Fdrivers\u002Fs3","2.drivers\u002Fs3","simple-icons:amazons3",{"title":123,"path":124,"stem":125,"icon":126},"UploadThing","\u002Fdrivers\u002Fuploadthing","2.drivers\u002Fuploadthing","qlementine-icons:cloud-16",{"title":128,"path":129,"stem":130,"icon":131},"Upstash","\u002Fdrivers\u002Fupstash","2.drivers\u002Fupstash","simple-icons:upstash",{"title":133,"path":134,"stem":135,"icon":136},"Vercel","\u002Fdrivers\u002Fvercel","2.drivers\u002Fvercel","gg:vercel",{"id":138,"title":118,"body":139,"description":669,"extension":670,"meta":671,"navigation":672,"path":119,"seo":673,"stem":120,"__hash__":674},"content\u002F2.drivers\u002Fs3.md",{"type":140,"value":141,"toc":659,"icon":121},"minimark",[142,154,163,168,179,184,187,206,209,213,216,373,378,400,404,407,540,543,582,602,606,609,612,615,617,629,633,636,638,655],[143,144,145,146,153],"p",{},"S3 driver allows storing KV data to ",[147,148,152],"a",{"href":149,"rel":150},"https:\u002F\u002Faws.amazon.com\u002Fs3\u002F",[151],"nofollow","Amazon S3"," or any other S3-compatible provider.",[143,155,156,157,162],{},"Driver implementation is lightweight and based on ",[147,158,161],{"href":159,"rel":160},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FFetch_API",[151],"fetch"," working with Node.js as well as edge workers.",[164,165,167],"h2",{"id":166},"usage","Usage",[143,169,170,174,175],{},[171,172,173],"strong",{},"Driver name:"," ",[176,177,178],"code",{},"s3",[180,181,183],"h3",{"id":182},"setup","Setup",[143,185,186],{},"Setup a \"Bucket\" in your S3-compatible provider. You need this info:",[188,189,190,194,197,200,203],"ul",{},[191,192,193],"li",{},"Access Key ID",[191,195,196],{},"Secret Access Key",[191,198,199],{},"Bucket name",[191,201,202],{},"Endpoint",[191,204,205],{},"Region",[143,207,208],{},"Make sure to install required peer dependencies:",[210,211],"pm-install",{"name":212},"aws4fetch",[143,214,215],{},"Then please make sure to set all driver's options:",[217,218,223],"pre",{"className":219,"code":220,"language":221,"meta":222,"style":222},"language-ts shiki shiki-themes github-light github-dark github-dark","import { createStorage } from \"unstorage\";\nimport s3Driver from \"unstorage\u002Fdrivers\u002Fs3\";\n\nconst storage = createStorage({\n  driver: s3Driver({\n    accessKeyId: \"\", \u002F\u002F Access Key ID\n    secretAccessKey: \"\", \u002F\u002F Secret Access Key\n    endpoint: \"\",\n    bucket: \"\",\n    region: \"\",\n  }),\n});\n","ts","",[176,224,225,248,263,270,290,301,317,330,341,351,361,367],{"__ignoreMap":222},[226,227,230,234,238,241,245],"span",{"class":228,"line":229},"line",1,[226,231,233],{"class":232},"so5gQ","import",[226,235,237],{"class":236},"slsVL"," { createStorage } ",[226,239,240],{"class":232},"from",[226,242,244],{"class":243},"sfrk1"," \"unstorage\"",[226,246,247],{"class":236},";\n",[226,249,251,253,256,258,261],{"class":228,"line":250},2,[226,252,233],{"class":232},[226,254,255],{"class":236}," s3Driver ",[226,257,240],{"class":232},[226,259,260],{"class":243}," \"unstorage\u002Fdrivers\u002Fs3\"",[226,262,247],{"class":236},[226,264,266],{"class":228,"line":265},3,[226,267,269],{"emptyLinePlaceholder":268},true,"\n",[226,271,273,276,280,283,287],{"class":228,"line":272},4,[226,274,275],{"class":232},"const",[226,277,279],{"class":278},"suiK_"," storage",[226,281,282],{"class":232}," =",[226,284,286],{"class":285},"shcOC"," createStorage",[226,288,289],{"class":236},"({\n",[226,291,293,296,299],{"class":228,"line":292},5,[226,294,295],{"class":236},"  driver: ",[226,297,298],{"class":285},"s3Driver",[226,300,289],{"class":236},[226,302,304,307,310,313],{"class":228,"line":303},6,[226,305,306],{"class":236},"    accessKeyId: ",[226,308,309],{"class":243},"\"\"",[226,311,312],{"class":236},", ",[226,314,316],{"class":315},"sCsY4","\u002F\u002F Access Key ID\n",[226,318,320,323,325,327],{"class":228,"line":319},7,[226,321,322],{"class":236},"    secretAccessKey: ",[226,324,309],{"class":243},[226,326,312],{"class":236},[226,328,329],{"class":315},"\u002F\u002F Secret Access Key\n",[226,331,333,336,338],{"class":228,"line":332},8,[226,334,335],{"class":236},"    endpoint: ",[226,337,309],{"class":243},[226,339,340],{"class":236},",\n",[226,342,344,347,349],{"class":228,"line":343},9,[226,345,346],{"class":236},"    bucket: ",[226,348,309],{"class":243},[226,350,340],{"class":236},[226,352,354,357,359],{"class":228,"line":353},10,[226,355,356],{"class":236},"    region: ",[226,358,309],{"class":243},[226,360,340],{"class":236},[226,362,364],{"class":228,"line":363},11,[226,365,366],{"class":236},"  }),\n",[226,368,370],{"class":228,"line":369},12,[226,371,372],{"class":236},"});\n",[143,374,375],{},[171,376,377],{},"Options:",[188,379,380],{},[191,381,382,385,386,389,390,393,394,399],{},[176,383,384],{},"bulkDelete",": Enabled by default to speedup ",[176,387,388],{},"clear()"," operation. Set to ",[176,391,392],{},"false"," if provider is not implementing ",[147,395,398],{"href":396,"rel":397},"https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonS3\u002Flatest\u002FAPI\u002FAPI_DeleteObjects.html",[151],"DeleteObject",".",[164,401,403],{"id":402},"setting-headers","Setting Headers",[143,405,406],{},"You can specify HTTP headers when storing items using the options parameter:",[217,408,410],{"className":219,"code":409,"language":221,"meta":222,"style":222},"\u002F\u002F Set Content-Type and Cache-Control\nawait storage.setItemRaw(\"image.png\", imageBuffer, {\n  headers: {\n    \"Content-Type\": \"image\u002Fpng\",\n    \"Cache-Control\": \"max-age=31536000\",\n  },\n});\n\n\u002F\u002F Set custom S3 metadata\nawait storage.setItem(\"document.json\", jsonString, {\n  headers: {\n    \"Content-Type\": \"application\u002Fjson\",\n    \"x-amz-meta-author\": \"john-doe\",\n  },\n});\n",[176,411,412,417,437,442,455,467,472,476,480,485,502,506,517,530,535],{"__ignoreMap":222},[226,413,414],{"class":228,"line":229},[226,415,416],{"class":315},"\u002F\u002F Set Content-Type and Cache-Control\n",[226,418,419,422,425,428,431,434],{"class":228,"line":250},[226,420,421],{"class":232},"await",[226,423,424],{"class":236}," storage.",[226,426,427],{"class":285},"setItemRaw",[226,429,430],{"class":236},"(",[226,432,433],{"class":243},"\"image.png\"",[226,435,436],{"class":236},", imageBuffer, {\n",[226,438,439],{"class":228,"line":265},[226,440,441],{"class":236},"  headers: {\n",[226,443,444,447,450,453],{"class":228,"line":272},[226,445,446],{"class":243},"    \"Content-Type\"",[226,448,449],{"class":236},": ",[226,451,452],{"class":243},"\"image\u002Fpng\"",[226,454,340],{"class":236},[226,456,457,460,462,465],{"class":228,"line":292},[226,458,459],{"class":243},"    \"Cache-Control\"",[226,461,449],{"class":236},[226,463,464],{"class":243},"\"max-age=31536000\"",[226,466,340],{"class":236},[226,468,469],{"class":228,"line":303},[226,470,471],{"class":236},"  },\n",[226,473,474],{"class":228,"line":319},[226,475,372],{"class":236},[226,477,478],{"class":228,"line":332},[226,479,269],{"emptyLinePlaceholder":268},[226,481,482],{"class":228,"line":343},[226,483,484],{"class":315},"\u002F\u002F Set custom S3 metadata\n",[226,486,487,489,491,494,496,499],{"class":228,"line":353},[226,488,421],{"class":232},[226,490,424],{"class":236},[226,492,493],{"class":285},"setItem",[226,495,430],{"class":236},[226,497,498],{"class":243},"\"document.json\"",[226,500,501],{"class":236},", jsonString, {\n",[226,503,504],{"class":228,"line":363},[226,505,441],{"class":236},[226,507,508,510,512,515],{"class":228,"line":369},[226,509,446],{"class":243},[226,511,449],{"class":236},[226,513,514],{"class":243},"\"application\u002Fjson\"",[226,516,340],{"class":236},[226,518,520,523,525,528],{"class":228,"line":519},13,[226,521,522],{"class":243},"    \"x-amz-meta-author\"",[226,524,449],{"class":236},[226,526,527],{"class":243},"\"john-doe\"",[226,529,340],{"class":236},[226,531,533],{"class":228,"line":532},14,[226,534,471],{"class":236},[226,536,538],{"class":228,"line":537},15,[226,539,372],{"class":236},[143,541,542],{},"Supported headers include:",[188,544,545,550,555,560,565,570,575],{},[191,546,547],{},[176,548,549],{},"Content-Type",[191,551,552],{},[176,553,554],{},"Cache-Control",[191,556,557],{},[176,558,559],{},"Content-Disposition",[191,561,562],{},[176,563,564],{},"Content-Encoding",[191,566,567],{},[176,568,569],{},"Content-Language",[191,571,572],{},[176,573,574],{},"Expires",[191,576,577,578,581],{},"Custom metadata via ",[176,579,580],{},"x-amz-meta-*"," prefixed headers",[583,584,585],"blockquote",{},[143,586,587,174,590,593,594,596,597,599,600,399],{},[171,588,589],{},"Note:",[176,591,592],{},"getMeta()"," only returns custom metadata headers (those with ",[176,595,580],{}," prefix). Standard headers like ",[176,598,549],{}," are set on the S3 object but not returned by ",[176,601,592],{},[164,603,605],{"id":604},"tested-providers","Tested providers",[143,607,608],{},"Any S3-compatible provider should work out of the box.\nPull-Requests are more than welcome to add info about other any other tested provider.",[180,610,152],{"id":611},"amazon-s3",[613,614],"read-more",{"title":152,"to":149},[143,616,377],{},[188,618,619],{},[191,620,621,622,625,626],{},"Set ",[176,623,624],{},"endpoint"," to ",[176,627,628],{},"https:\u002F\u002Fs3.[region].amazonaws.com\u002F",[180,630,632],{"id":631},"cloudflare-r2","Cloudflare R2",[613,634],{"title":632,"to":635},"https:\u002F\u002Fwww.cloudflare.com\u002Fdeveloper-platform\u002Fproducts\u002Fr2\u002F",[143,637,377],{},[188,639,640,647],{},[191,641,621,642,625,644],{},[176,643,624],{},[176,645,646],{},"https:\u002F\u002F[uid].r2.cloudflarestorage.com\u002F",[191,648,621,649,625,652],{},[176,650,651],{},"region",[176,653,654],{},"auto",[656,657,658],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":222,"searchDepth":250,"depth":250,"links":660},[661,664,665],{"id":166,"depth":250,"text":167,"children":662},[663],{"id":182,"depth":265,"text":183},{"id":402,"depth":250,"text":403},{"id":604,"depth":250,"text":605,"children":666},[667,668],{"id":611,"depth":265,"text":152},{"id":631,"depth":265,"text":632},"Store data to storage to S3-compatible providers.","md",{"icon":121},{"icon":121},{"title":118,"description":669},"DeG5X3vAlcOG0qaRmpvu6lxCfyjQld4gG4Ph392WLP0",[676,678],{"title":113,"path":114,"stem":115,"description":677,"icon":116,"children":-1},"Store data in a Redis.",{"title":123,"path":124,"stem":125,"description":679,"icon":126,"children":-1},"Store data using UploadThing.",1781217591583]