mirror of
https://github.com/vlang/v.git
synced 2025-09-14 06:52:36 +03:00
encoding.csv: add a new utility fn new_reader_from_file/2
(#20530)
This commit is contained in:
parent
2f58ac3866
commit
43b8cc8ab7
2 changed files with 37 additions and 0 deletions
12
vlib/encoding/csv/utils.v
Normal file
12
vlib/encoding/csv/utils.v
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
|
||||
// Use of this source code is governed by an MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
module csv
|
||||
|
||||
import os
|
||||
|
||||
// new_reader_from_file create a csv reader from a file
|
||||
pub fn new_reader_from_file(csv_file_path string, config ReaderConfig) !&Reader {
|
||||
csv_file_content := os.read_file(csv_file_path)!
|
||||
return new_reader(csv_file_content, config)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue