File tree Expand file tree Collapse file tree
apps/web/playwright/sample-files Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ Copyright 2026 Element Creations Ltd.
3+
4+ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+ Please see LICENSE files in the repository root for full details.
6+ */
7+
8+ import { dirname , join } from "node:path" ;
9+ import { fileURLToPath } from "node:url" ;
10+ import { readFile } from "node:fs/promises" ;
11+ import { readFileSync } from "node:fs" ;
12+
13+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
14+
15+ export function getSampleFilePath ( file : string ) : string {
16+ return join ( __dirname , file ) ;
17+ }
18+
19+ export function readSampleFile ( file : string , encoding : null ) : Promise < NonSharedBuffer > ;
20+ export function readSampleFile ( file : string , encoding ?: BufferEncoding ) : Promise < string > ;
21+ export function readSampleFile (
22+ file : string ,
23+ encoding : BufferEncoding | null = "utf-8" ,
24+ ) : Promise < NonSharedBuffer | string > {
25+ return readFile ( getSampleFilePath ( file ) , encoding ) ;
26+ }
27+
28+ export function readSampleFileSync ( file : string , encoding : null ) : NonSharedBuffer ;
29+ export function readSampleFileSync ( file : string , encoding ?: BufferEncoding ) : string ;
30+ export function readSampleFileSync ( file : string , encoding : BufferEncoding | null = "utf-8" ) : NonSharedBuffer | string {
31+ return readFileSync ( getSampleFilePath ( file ) , encoding ) ;
32+ }
You can’t perform that action at this time.
0 commit comments