Create fake data for documents

This commit is contained in:
tekh 2025-07-09 13:18:51 +02:00
parent 480393743f
commit 0009ceae81
2 changed files with 40 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import {
_postTitles,
_description,
_productNames,
_base64,
} from './_mock';
// ----------------------------------------------------------------------
@ -248,30 +249,42 @@ export const _filters: Filter[] = [
// ----------------------------------------------------------------------
function base64ToUint8Array(base64: string): Uint8Array {
const binaryString = atob(base64); // Decode base64 to binary string
const len = binaryString.length;
const bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes;
}
export const documents: Doc[] = [
{
id: 1,
name: "example1.pdf",
data: new Uint8Array([37, 80, 68, 70, 45])
data: base64ToUint8Array(_base64.example1_pdf)
},
{
id: 2,
name: "example2.pdf",
data: new Uint8Array([37, 80, 68, 70, 45, 49, 46])
data: base64ToUint8Array(_base64.example2_pdf)
},
{
id: 3,
name: "document1.docx",
data: new Uint8Array([80, 75, 3, 4, 20])
data: base64ToUint8Array(_base64.document1_docx)
},
{
id: 4,
name: "spreadsheet1.xlsx",
data: new Uint8Array([80, 75, 3, 4, 20])
data: base64ToUint8Array(_base64.spreadsheet1_xlsx)
},
{
id: 5,
name: "report.docx",
data: new Uint8Array([80, 75, 3, 4, 20, 0, 6])
data: base64ToUint8Array(_base64.report_docx)
},
];

File diff suppressed because one or more lines are too long