harshcut
harshcut
Explore posts from servers
DTDrizzle Team
Created by harshcut on 5/2/2024 in #help
Help needed for Nested Query
This is what i got working!
await db
.select({ episodeId: bookmarks.episodeId })
.from(bookmarks)
.leftJoin(episodes, eq(bookmarks.episodeId, episodes.id))
.where(and(eq(bookmarks.userId, userId), eq(episodes.podcastId, body.podcastId)))
await db
.select({ episodeId: bookmarks.episodeId })
.from(bookmarks)
.leftJoin(episodes, eq(bookmarks.episodeId, episodes.id))
.where(and(eq(bookmarks.userId, userId), eq(episodes.podcastId, body.podcastId)))
2 replies
DTDrizzle Team
Created by Kyrre Gjerstad on 3/22/2024 in #help
mysql2 driver in edge middleware
even the local mysql server?
6 replies
DTDrizzle Team
Created by yousuf4you on 3/24/2024 in #help
Why returning not support in MySQL2??
if you want the return want id of the created row, that is available in the awaited response
4 replies
DTDrizzle Team
Created by Kyrre Gjerstad on 3/22/2024 in #help
mysql2 driver in edge middleware
AFAIK the mysql2 sriver does not support edge runtime yet
6 replies
TTCTheo's Typesafe Cult
Created by harshcut on 4/10/2024 in #questions
Streaming file from Client to Server to S3
also this is the console log from req.file
{
fieldname: 'file',
originalname: 'FILE_NAME.pdf',
encoding: '7bit',
mimetype: 'application/pdf',
buffer: <Buffer >,
size: 0
}
{
fieldname: 'file',
originalname: 'FILE_NAME.pdf',
encoding: '7bit',
mimetype: 'application/pdf',
buffer: <Buffer >,
size: 0
}
14 replies
TTCTheo's Typesafe Cult
Created by harshcut on 4/10/2024 in #questions
Streaming file from Client to Server to S3
No description
14 replies
TTCTheo's Typesafe Cult
Created by harshcut on 4/10/2024 in #questions
Streaming file from Client to Server to S3
data is an internal variable in a library.
server:dev: /home/harsh/Documents/GitHub/s3-upload/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:160 server:dev: if (typeof data.stream === "function") { server:dev: ^ server:dev: TypeError: Cannot read properties of undefined (reading 'stream') server:dev: at getChunk (/home/harsh/Documents/GitHub/s3-upload/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:160:19) server:dev: at _Upload.__doMultipartUpload (/home/harsh/Documents/GitHub/s3-upload/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:374:24)
14 replies
TTCTheo's Typesafe Cult
Created by harshcut on 4/10/2024 in #questions
Streaming file from Client to Server to S3
The answer is yes.
@JulieCezar I don't think the file is streamable when sending it using formData. Below is the code I'm using on my Express server and it throws an error.
import { Upload } from '@aws-sdk/lib-storage'
const upload = multer()
...
app.post('/upload', checkAuthentication, upload.single('file'), uploadStream)
...
export const uploadStream = async (req, res) => {
const fileId = crypto.randomUUID()
const parallelUploads3 = new Upload({
client: s3,
params: {
Bucket: bucketName,
Key: fileId,
Body: file.stream
// ?^ stream does not exist on file object
},
queueSize: 1,
})
}
import { Upload } from '@aws-sdk/lib-storage'
const upload = multer()
...
app.post('/upload', checkAuthentication, upload.single('file'), uploadStream)
...
export const uploadStream = async (req, res) => {
const fileId = crypto.randomUUID()
const parallelUploads3 = new Upload({
client: s3,
params: {
Bucket: bucketName,
Key: fileId,
Body: file.stream
// ?^ stream does not exist on file object
},
queueSize: 1,
})
}
if (typeof data.stream === "function") { ^ TypeError: Cannot read properties of undefined (reading 'stream')
14 replies
TTCTheo's Typesafe Cult
Created by harshcut on 4/10/2024 in #questions
Streaming file from Client to Server to S3
I am creating this app as an excersise to learn and understand streams and piping data, and won't probably use presigned url logic.
14 replies
TTCTheo's Typesafe Cult
Created by harshcut on 4/10/2024 in #questions
Streaming file from Client to Server to S3
Few questions: 1. When uploading a large file from the client to s3, what should be the expiry for the presignedPostURL? 2. I also want to save the file metadata on a MongoDB database. So, do I make a POST request again to Express to save data to MongoDB after the upload is complete? Or, maybe I could add upload_state as pending on the initial request to get the presignedPostURL?
14 replies
TTCTheo's Typesafe Cult
Created by harshcut on 2/25/2024 in #questions
`MaxListenersExceededWarning` on using `tailFile.on` inside `socket` connection
some more information that might help: - i will only push update data to connections, and won't receive any from them - every new connection will be sent init data, and thereafter only update data
2 replies
TTCTheo's Typesafe Cult
Created by harshcut on 7/2/2023 in #questions
importing data into [slug]
wont be server rendered 😦
20 replies
TTCTheo's Typesafe Cult
Created by harshcut on 7/2/2023 in #questions
importing data into [slug]
the shared stuff will all go into layout.tsx and yes, the specific stuff could be added from props
20 replies
TTCTheo's Typesafe Cult
Created by harshcut on 7/2/2023 in #questions
importing data into [slug]
currently am i hardcoding the pages. i thought there might an easy way with slugs, as i could just plug the components and write the reusable functions directly into [slug]/page.tsx
20 replies
TTCTheo's Typesafe Cult
Created by harshcut on 7/2/2023 in #questions
importing data into [slug]
i was thinking the same thing, but i dont think this the right way
20 replies
TTCTheo's Typesafe Cult
Created by harshcut on 7/2/2023 in #questions
importing data into [slug]
is there an example repo?
20 replies
TTCTheo's Typesafe Cult
Created by harshcut on 7/2/2023 in #questions
importing data into [slug]
i know how to get the id. currently this is my file structure /craft/page.tsx /craft/craft-1/page.tsx /craft/craft-2/page.tsx each craft-n/page has different client react components. how do i store these pages and import them depending upon the id
20 replies
TTCTheo's Typesafe Cult
Created by H on 6/20/2023 in #questions
Ui component name
i made this some time ago
5 replies
TTCTheo's Typesafe Cult
Created by H on 6/20/2023 in #questions
Ui component name
5 replies
TTCTheo's Typesafe Cult
Created by harshcut on 6/18/2023 in #questions
is this the correct use of usecallback?
also how to check if a function (in this case foo) is recreated or not?
7 replies