Skip to content

Instantly share code, notes, and snippets.

View samocodes's full-sized avatar
🥄
I do spoon feeds

Samir samocodes

🥄
I do spoon feeds
View GitHub Profile
@samocodes
samocodes / s3.ts
Last active January 10, 2024 12:55
List all objects from s3 in nodejs with typescript
import { ListObjectsV2Command, type _Object } from "@aws-sdk/client-s3";
let size = 0;
let keys: _Object[] = [];
const BUCKET_NAME = "":
const OBJECTS_PREFIX = "";
async function fetchObjects(StartAfter?: string) {
const listCmd = new ListObjectsV2Command({ Bucket: BUCKET_NAME, Prefix: OBJECTS_PREFIX, StartAfter });
@samocodes
samocodes / firebase-blob-uplaod.svelte
Created June 16, 2023 17:00
A simple code to upload blob on firebase storage.
<script lang="ts">
import firebaseApp from '$lib/firebase';
import { uploadBytes, getStorage, ref } from 'firebase/storage';
const onChange = (event: Event) => {
const target = event.target as HTMLInputElement;
if (!target) return;
if (target.files && target.files.length > 0) {
const selectedFile = target.files[0];