Skip to content

Commit

Permalink
remove fs dependency from common
Browse files Browse the repository at this point in the history
  • Loading branch information
adrastaea committed Feb 4, 2025
1 parent 45d855a commit 3f9192f
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions packages/common/src/tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import fs from 'fs'
import crypto from 'crypto'

import { InvitationData, InvitationDataV1, InvitationDataV2, InvitationDataVersion } from '@quiet/types'
import { composeInvitationDeepUrl, composeInvitationShareUrl } from './invitationLink/invitationLink'
import { QUIET_JOIN_PAGE } from './const'
Expand Down Expand Up @@ -89,18 +86,3 @@ export function getValidInvitationUrlTestData<T extends InvitationData>(data: T)
// data: data,
// }
// }

export const createArbitraryFile = (filePath: string, sizeBytes: number) => {
const stream = fs.createWriteStream(filePath)
const maxChunkSize = 1048576 // 1MB

let remainingSize = sizeBytes

while (remainingSize > 0) {
const chunkSize = Math.min(maxChunkSize, remainingSize)
stream.write(crypto.randomBytes(chunkSize))
remainingSize -= chunkSize
}

stream.end()
}

0 comments on commit 3f9192f

Please sign in to comment.