Skip to contents

ac_detect_file() returns whether each file has at least one pattern match.

Usage

ac_detect_file(ac, path, stream = FALSE)

Arguments

ac

An <ac_automaton> object created by ac_build().

path

A vector of file paths to search.

stream

If FALSE (default), each file is read into memory before searching. If TRUE, files are searched as streams. Stream search requires an automaton built with match_kind = "standard".

Value

A logical vector with the same length as path.

Examples

ac <- ac_build(c("hello", "world"))
path <- tempfile()
writeLines("hello world", path)
ac_detect_file(ac, path)
#> [1] TRUE