MCPcopy Create free account
hub / github.com/HelloCSV/HelloCSV / uploadFile

Method uploadFile

src/importer/state.tsx:103–135  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

101 }
102
103 public async uploadFile(file: File) {
104 const csvFile = await convertCsvFile(
105 file,
106 this.importerDefinition.customFileLoaders
107 );
108
109 const newParsed = await parseCsv({ file: csvFile });
110
111 const csvHeaders = newParsed.meta.fields!;
112
113 const suggestedMappings =
114 this.importerDefinition.customSuggestedMapper != null
115 ? await this.importerDefinition.customSuggestedMapper(
116 this.importerDefinition.sheets,
117 csvHeaders
118 )
119 : buildSuggestedHeaderMappings(
120 this.importerDefinition.sheets,
121 csvHeaders
122 );
123
124 this.buildSteps.push({
125 type: 'FILE_PARSED',
126 payload: { parsed: newParsed, rowFile: file },
127 });
128
129 this.buildSteps.push({
130 type: 'COLUMN_MAPPING_CHANGED',
131 payload: {
132 mappings: suggestedMappings,
133 },
134 });
135 }
136
137 public setEnterDataManually(amountOfEmptyRowsToAdd?: number) {
138 this.buildSteps.push({

Callers 1

onFileUploadedFunction · 0.80

Calls 4

convertCsvFileFunction · 0.90
parseCsvFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected