npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hlsrules-test/fc-libreoffice

v1.0.3

Published

**注意: 下面借助于 OSS 解压的方法已经不推荐,仅供学习而保留,对于大文件和依赖目前更推荐 NAS 方案,希望快速上手请移步 https://github.com/vangie/libreoffice-example**

Downloads

6

Readme

fc-libreoffice

注意: 下面借助于 OSS 解压的方法已经不推荐,仅供学习而保留,对于大文件和依赖目前更推荐 NAS 方案,希望快速上手请移步 https://github.com/vangie/libreoffice-example

fc-libreoffice 是一个开箱即用的 word 转 pdf NPM 包。

fc-docker 提供的 runtime-nodejs8 环境下编译,并且进行了精简,采用了压缩比最高的 Brotli 工具进行打包,最终压缩包大小为 84 M。这个大小仍然超过了 FC 50M 的代码包限制,所以采用 OSS 运行时下载并解压的方式制作了 example 工程。example 工程提供了方便的 Makefile 脚本,集成了 fun ,简单配置后可以快捷部署。

安装

npm install awesome-fc/fc-libreoffice#master --save

使用

const { convertFileToPDF } = require('fc-libreoffice');

module.exports.handler = (event, context, callback) => {
    convertFileToPDF('/tmp/example.docx', binPath)
        .then(() => {
            console.log('convert success.');
            callback(null, 'done');
        })
        .catch((e) => {
            console.log('convert success.');
            callback(e, 'fail')
        });

};

快速体验

# 克隆项目
git clone https://github.com/awesome-fc/fc-libreoffice.git

# 进入示例工程目录
cd fc-libreoffice/example

# 配置 .env 文件
cp env.example .env

# 部署函数
make deploy

# 调用函数
make invoke

# 从 OSS 下载 PDF 到当前目录,查看转换后的结果
make download

编译 libreoffice

bin 目录下已经放置了一个在 fc 环境下编译好的 lo.tar.br 打包文件,所以正常情况下不需要编译。

找一台 linux 机器,mac 下编译会有问题。预先安装好 docker 即可。

cd compile/
./build.sh

最终会生成 lo.tar.br 文件。

参考阅读

  1. https://github.com/shelfio/aws-lambda-libreoffice
  2. https://github.com/vladgolubev/serverless-libreoffice
  3. https://github.com/shelfio/aws-lambda-brotli-unpacker