File: reader.rs

package info (click to toggle)
rust-docx-rs 0.4.18-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,072 kB
  • sloc: xml: 194; makefile: 7
file content (15 lines) | stat: -rw-r--r-- 384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use docx_rs::*;

use std::fs::File;
use std::io::{Read, Write};

pub fn main() {
    let mut file = File::open("./hello.docx").unwrap();
    let mut buf = vec![];
    file.read_to_end(&mut buf).unwrap();

    let mut file = File::create("./hello.json").unwrap();
    let res = read_docx(&buf).unwrap().json();
    file.write_all(res.as_bytes()).unwrap();
    file.flush().unwrap();
}