@edgedev/firebase 2.1.56 → 2.1.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/firebase",
3
- "version": "2.1.56",
3
+ "version": "2.1.58",
4
4
  "description": "Vue 3 / Nuxt 3 Plugin or Nuxt 3 plugin for firebase authentication and firestore.",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -123,14 +123,17 @@ exports.toR2 = onObjectFinalized(
123
123
 
124
124
  // Download file into memory from bucket.
125
125
  const bucket = admin.storage().bucket(fileBucket)
126
- const downloadResponse = await bucket.file(filePath).download()
127
- const file = downloadResponse[0]
126
+
127
+ const fileStream = bucket.file(filePath).createReadStream()
128
+
129
+ // const downloadResponse = await bucket.file(filePath).download()
130
+ // const file = downloadResponse[0]
128
131
 
129
132
  // Upload the file to Cloudflare R2.
130
133
  const params = {
131
134
  Bucket: 'files',
132
135
  Key: r2FilePath,
133
- Body: file,
136
+ Body: fileStream,
134
137
  ContentType: contentType,
135
138
  }
136
139
  const fileRef = bucket.file(filePath)
@@ -140,6 +143,14 @@ exports.toR2 = onObjectFinalized(
140
143
  const orgId = event.data.metadata?.orgId
141
144
  const docRef = db.collection(`organizations/${orgId}/files`).doc(fileDocId)
142
145
  await docRef.set({ r2FilePath, r2URL, uploadCompletedToR2: true }, { merge: true })
146
+
147
+ // const base64Image = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB/ax3OTkAAAAASUVORK5CYII='
148
+ // const imageBuffer = Buffer.from(base64Image, 'base64')
149
+
150
+ // await fileRef.save(imageBuffer, {
151
+ // contentType: 'image/png',
152
+ // })
153
+
143
154
  const blankBuffer = Buffer.from('')
144
155
  await fileRef.save(blankBuffer, {
145
156
  contentType: 'application/octet-stream',
package/src/package.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "functions",
3
+ "type": "commonjs",
3
4
  "private": true,
4
5
  "description": "Cloud Functions for Firebase",
5
6
  "main": "index.js",